From 4008493ab2e22d1e7117f9524a7458869afd1b8d Mon Sep 17 00:00:00 2001 From: emad-salah Date: Wed, 12 Aug 2020 15:07:57 +0100 Subject: [PATCH 1/3] Removed Channel Backups error --- src/routes.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes.js b/src/routes.js index 8c016615..f64f2691 100644 --- a/src/routes.js +++ b/src/routes.js @@ -582,13 +582,15 @@ module.exports = async ( logger.error('Channel backup stream error:', err) }) stream.on('status', status => { - logger.error('Channel backup stream status:', status) if (status.code === 14) { // Prevents call stack overflow exceptions - process.nextTick(onNewChannelBackup) + process.nextTick(() => setTimeout(onNewChannelBackup, 30000)) + } else { + logger.error('Channel backup stream status:', status) } }) } + onNewChannelBackup() // Generate auth token and send it as a JSON response From 03430e33ffc8659e6c271818b8427b86c5b764af Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Fri, 14 Aug 2020 18:36:19 +0200 Subject: [PATCH 2/3] fix send payment --- src/routes.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/routes.js b/src/routes.js index 8c016615..ab6ce592 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1459,7 +1459,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 @@ -1467,7 +1468,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) { @@ -1481,17 +1483,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) From 756d84920d8e5e2bc015f070716a44daa2bfa972 Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Sat, 15 Aug 2020 19:46:15 +0200 Subject: [PATCH 3/3] better logs send payment --- src/routes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes.js b/src/routes.js index ab6ce592..064aab5a 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1485,13 +1485,13 @@ module.exports = async ( //if res was already sent if (response.status !== 'SUCCEEDED') { //if the operation failed - finalEvent = { error: response.failure_reason } + logger.error('Sen payment failure', response.details) } else { finalEvent = { status: response.status } } } else { if (response.status !== 'SUCCEEDED') { - logger.error('SendPayment Info:', response) + logger.error('Sen payment failure', response.details) return res.status(500).json({ errorMessage: sanitizeLNDError(response.details) }) @@ -1508,12 +1508,12 @@ module.exports = async ( sentPayment.on('error', async err => { logger.error('SendPayment Error:', err) if (res.headersSent) { - finalEvent = { error: err.details } //send error on socket if http has already finished + logger.error('Sen payment failure', err) } else { const health = await checkHealth() if (health.LNDStatus.success) { res.status(500).json({ - errorMessage: sanitizeLNDError(err.details) + errorMessage: sanitizeLNDError(err) }) } else { res.status(500)