From 1eaa6802b4d84dd6346757640d913e897b7dc5ae Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Tue, 14 May 2024 17:20:04 +0200 Subject: [PATCH] ceil the sum --- src/services/main/watchdog.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/main/watchdog.ts b/src/services/main/watchdog.ts index 2e64c0e9..257e2614 100644 --- a/src/services/main/watchdog.ts +++ b/src/services/main/watchdog.ts @@ -74,9 +74,9 @@ export class Watchdog { this.log(Number(walletBalance.confirmedBalance), "sats in chain wallet") const channelsBalance = await this.lnd.GetChannelBalance() getLogger({ component: "debugLndBalancev3" })({ w: walletBalance, c: channelsBalance, u: usersTotal, f: this.accumulatedHtlcFees }) - const localChannelsBalance = channelsBalance.localBalance ? Math.ceil(Number(channelsBalance.localBalance.msat) / 1000) : 0 - const unsettledLocalBalance = channelsBalance.unsettledLocalBalance ? Math.ceil(Number(channelsBalance.unsettledLocalBalance.msat) / 1000) : 0 - return Number(walletBalance.confirmedBalance) + localChannelsBalance + unsettledLocalBalance + const totalLightningBalanceMsats = (channelsBalance.localBalance?.msat || 0n) + (channelsBalance.unsettledLocalBalance?.msat || 0n) + const totalLightningBalance = Math.ceil(Number(totalLightningBalanceMsats) / 1000) + return Number(walletBalance.confirmedBalance) + totalLightningBalance } checkBalanceUpdate = (deltaLnd: number, deltaUsers: number) => {