From b4a13bb2dffade6b78026666a72c87d2d70f8d9d Mon Sep 17 00:00:00 2001 From: Shahana Farooqui Date: Wed, 31 May 2023 15:16:19 -0700 Subject: [PATCH 1/4] Version Update --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b41b48..600246f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "c-lightning-rest", - "version": "0.10.3", + "version": "0.10.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "c-lightning-rest", - "version": "0.10.2", + "version": "0.10.4", "license": "MIT", "dependencies": { "atob": "^2.1.2", diff --git a/package.json b/package.json index 5512364..83af002 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c-lightning-rest", - "version": "0.10.3", + "version": "0.10.4", "description": "c-lightning REST API suite", "main": "cl-rest.js", "scripts": { From 8fd733869a4dc79a4ae8a3f227dd66204e835238 Mon Sep 17 00:00:00 2001 From: Shahana Farooqui Date: Wed, 31 May 2023 15:22:25 -0700 Subject: [PATCH 2/4] Bug fix: LocalRemote Balance Precision #177 --- controllers/localRemoteBal.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/controllers/localRemoteBal.js b/controllers/localRemoteBal.js index 92e89eb..fa8bc21 100644 --- a/controllers/localRemoteBal.js +++ b/controllers/localRemoteBal.js @@ -51,16 +51,22 @@ exports.localRemoteBal = (req,res) => { for (var i = 0; i < chanArray.length; i++ ) { if((chanArray[i].state === 'CHANNELD_NORMAL') && chanArray[i].connected === true) { - localBalance = localBalance + (versionCompatible ? (chanArray[i].our_amount_msat/1000) : chanArray[i].channel_sat); - remoteBalance = remoteBalance + (versionCompatible ? (chanArray[i].amount_msat/1000) : (chanArray[i].channel_total_sat - chanArray[i].channel_sat)); + localBalance = localBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); + remoteBalance = remoteBalance + (versionCompatible ? (chanArray[i].amount_msat) : (chanArray[i].channel_total_sat - chanArray[i].channel_sat)); } else if((chanArray[i].state === 'CHANNELD_NORMAL') && chanArray[i].connected === false) { - inactiveBalance = inactiveBalance + (versionCompatible ? (chanArray[i].our_amount_msat/1000) : chanArray[i].channel_sat); + inactiveBalance = inactiveBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); } else if(chanArray[i].state === 'CHANNELD_AWAITING_LOCKIN') { - pendingBalance = pendingBalance + (versionCompatible ? (chanArray[i].our_amount_msat/1000) : chanArray[i].channel_sat); + pendingBalance = pendingBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); } } + if (versionCompatible) { + localBalance = localBalance / 1000; + remoteBalance = remoteBalance / 1000; + inactiveBalance = inactiveBalance / 1000; + pendingBalance = pendingBalance / 1000; + } global.logger.log('localbalance -> ' + localBalance); global.logger.log('remotebalance -> ' + remoteBalance); global.logger.log('pendingBalance -> ' + pendingBalance); From 107fce1aca8cc7940c6886c8c90aa0f386254453 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Sun, 18 Jun 2023 18:48:56 -0700 Subject: [PATCH 3/4] Remote and Pending Balance Calculation Fix --- controllers/localRemoteBal.js | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/localRemoteBal.js b/controllers/localRemoteBal.js index fa8bc21..dc8a7dc 100644 --- a/controllers/localRemoteBal.js +++ b/controllers/localRemoteBal.js @@ -52,12 +52,12 @@ exports.localRemoteBal = (req,res) => { { if((chanArray[i].state === 'CHANNELD_NORMAL') && chanArray[i].connected === true) { localBalance = localBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); - remoteBalance = remoteBalance + (versionCompatible ? (chanArray[i].amount_msat) : (chanArray[i].channel_total_sat - chanArray[i].channel_sat)); + remoteBalance = remoteBalance + (versionCompatible ? (chanArray[i].amount_msat - chanArray[i].our_amount_msat) : (chanArray[i].channel_total_sat - chanArray[i].channel_sat)); } else if((chanArray[i].state === 'CHANNELD_NORMAL') && chanArray[i].connected === false) { inactiveBalance = inactiveBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); } - else if(chanArray[i].state === 'CHANNELD_AWAITING_LOCKIN') { + else if(chanArray[i].state === 'CHANNELD_AWAITING_LOCKIN' || chanArray[i].state === 'DUALOPEND_AWAITING_LOCKIN') { pendingBalance = pendingBalance + (versionCompatible ? (chanArray[i].our_amount_msat) : chanArray[i].channel_sat); } } diff --git a/package-lock.json b/package-lock.json index 600246f..341384e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "c-lightning-rest", - "version": "0.10.4", + "version": "0.10.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "c-lightning-rest", - "version": "0.10.4", + "version": "0.10.5", "license": "MIT", "dependencies": { "atob": "^2.1.2", diff --git a/package.json b/package.json index 83af002..02efa33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c-lightning-rest", - "version": "0.10.4", + "version": "0.10.5", "description": "c-lightning REST API suite", "main": "cl-rest.js", "scripts": { From 6e1e741522d411f7637e568724cb380984f2b3ea Mon Sep 17 00:00:00 2001 From: Shahana Farooqui Date: Sun, 18 Jun 2023 23:34:16 -0700 Subject: [PATCH 4/4] Reverse package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 341384e..600246f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "c-lightning-rest", - "version": "0.10.5", + "version": "0.10.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "c-lightning-rest", - "version": "0.10.5", + "version": "0.10.4", "license": "MIT", "dependencies": { "atob": "^2.1.2", diff --git a/package.json b/package.json index 02efa33..83af002 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c-lightning-rest", - "version": "0.10.5", + "version": "0.10.4", "description": "c-lightning REST API suite", "main": "cl-rest.js", "scripts": {