From bd2fef6be91e31f94f843626fbb3c36a35d94c09 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Tue, 14 Jul 2020 19:12:32 +0200 Subject: [PATCH] only active channels. only bigger channel --- src/routes.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/routes.js b/src/routes.js index 701a5aef..dde027ba 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1470,7 +1470,7 @@ module.exports = async ( logger.debug("AddInvoice:", newInvoice); if (req.body.value) { logger.debug("AddInvoice liquidity check:"); - lightning.listChannels({}, async (err, response) => { + lightning.listChannels({active_only:true}, async (err, response) => { if (err) { logger.debug("ListChannels Error:", err); const health = await checkHealth(); @@ -1488,7 +1488,10 @@ module.exports = async ( const channelsList = response.channels let remoteBalance = Big(0) channelsList.forEach(element=>{ - remoteBalance = remoteBalance.plus(Big(element.remote_balance)) + const remB = Big(element.remote_balance) + if(remB.gt(remoteBalance)){ + remoteBalance = remB + } }) newInvoice.liquidityCheck = remoteBalance > req.body.value //newInvoice.remoteBalance = remoteBalance