Merge pull request #685 from shocknet/use-msats

Use msats
This commit is contained in:
Justin (shocknet) 2024-05-14 11:22:16 -04:00 committed by GitHub
commit aafccfb32e
2 changed files with 4 additions and 5 deletions

View file

@ -298,7 +298,7 @@ export default class {
return return
case Payment_PaymentStatus.SUCCEEDED: case Payment_PaymentStatus.SUCCEEDED:
this.log("invoice payment succeded", Number(payment.valueSat)) this.log("invoice payment succeded", Number(payment.valueSat))
res({ feeSat: Number(payment.feeSat), valueSat: Number(payment.valueSat), paymentPreimage: payment.paymentPreimage }) res({ feeSat: Math.ceil(Number(payment.feeMsat) / 1000), valueSat: Number(payment.valueSat), paymentPreimage: payment.paymentPreimage })
} }
}) })
}) })

View file

@ -74,10 +74,9 @@ export class Watchdog {
this.log(Number(walletBalance.confirmedBalance), "sats in chain wallet") this.log(Number(walletBalance.confirmedBalance), "sats in chain wallet")
const channelsBalance = await this.lnd.GetChannelBalance() const channelsBalance = await this.lnd.GetChannelBalance()
getLogger({ component: "debugLndBalancev3" })({ w: walletBalance, c: channelsBalance, u: usersTotal, f: this.accumulatedHtlcFees }) getLogger({ component: "debugLndBalancev3" })({ w: walletBalance, c: channelsBalance, u: usersTotal, f: this.accumulatedHtlcFees })
const totalLightningBalanceMsats = (channelsBalance.localBalance?.msat || 0n) + (channelsBalance.unsettledLocalBalance?.msat || 0n)
const localChannelsBalance = Number(channelsBalance.localBalance?.sat || 0) const totalLightningBalance = Math.ceil(Number(totalLightningBalanceMsats) / 1000)
const unsettledLocalBalance = Number(channelsBalance.unsettledLocalBalance?.sat || 0) return Number(walletBalance.confirmedBalance) + totalLightningBalance
return Number(walletBalance.confirmedBalance) + localChannelsBalance + unsettledLocalBalance
} }
checkBalanceUpdate = (deltaLnd: number, deltaUsers: number) => { checkBalanceUpdate = (deltaLnd: number, deltaUsers: number) => {