only active channels. only bigger channel
This commit is contained in:
parent
b54598a941
commit
bd2fef6be9
1 changed files with 5 additions and 2 deletions
|
|
@ -1470,7 +1470,7 @@ module.exports = async (
|
||||||
logger.debug("AddInvoice:", newInvoice);
|
logger.debug("AddInvoice:", newInvoice);
|
||||||
if (req.body.value) {
|
if (req.body.value) {
|
||||||
logger.debug("AddInvoice liquidity check:");
|
logger.debug("AddInvoice liquidity check:");
|
||||||
lightning.listChannels({}, async (err, response) => {
|
lightning.listChannels({active_only:true}, async (err, response) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.debug("ListChannels Error:", err);
|
logger.debug("ListChannels Error:", err);
|
||||||
const health = await checkHealth();
|
const health = await checkHealth();
|
||||||
|
|
@ -1488,7 +1488,10 @@ module.exports = async (
|
||||||
const channelsList = response.channels
|
const channelsList = response.channels
|
||||||
let remoteBalance = Big(0)
|
let remoteBalance = Big(0)
|
||||||
channelsList.forEach(element=>{
|
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.liquidityCheck = remoteBalance > req.body.value
|
||||||
//newInvoice.remoteBalance = remoteBalance
|
//newInvoice.remoteBalance = remoteBalance
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue