Merge pull request #145 from shocknet/fix/sendpayment-fix

fix send payment
This commit is contained in:
CapDog 2020-08-14 16:00:35 -04:00 committed by GitHub
commit 26c4a8c61d

View file

@ -1473,7 +1473,8 @@ module.exports = async (
},
payment_hash: r_hash,
max_parts: maxParts,
timeout_seconds: timeoutSeconds
timeout_seconds: timeoutSeconds,
no_inflight_updates: true
}
} else {
const { payreq } = req.body
@ -1481,7 +1482,8 @@ module.exports = async (
paymentRequest = {
payment_request: payreq,
max_parts: maxParts,
timeout_seconds: timeoutSeconds
timeout_seconds: timeoutSeconds,
no_inflight_updates: true
}
if (req.body.amt) {
@ -1495,17 +1497,17 @@ module.exports = async (
sentPayment.on('data', response => {
if (res.headersSent) {
//if res was already sent
if (response.failure_reason !== 'FAILURE_REASON_NONE') {
if (response.status !== 'SUCCEEDED') {
//if the operation failed
finalEvent = { error: response.failure_reason }
} else {
finalEvent = { status: response.status }
}
} else {
if (response.failure_reason !== 'FAILURE_REASON_NONE') {
if (response.status !== 'SUCCEEDED') {
logger.error('SendPayment Info:', response)
return res.status(500).json({
errorMessage: response.failure_reason
errorMessage: sanitizeLNDError(response.details)
})
}
logger.info('SendPayment Data:', response)