fix chans source
This commit is contained in:
parent
de91573f2e
commit
d376623276
1 changed files with 3 additions and 5 deletions
|
|
@ -25,13 +25,11 @@ export default class Handler {
|
||||||
|
|
||||||
async NewBlockCb(height: number, balanceInfo: BalanceInfo) {
|
async NewBlockCb(height: number, balanceInfo: BalanceInfo) {
|
||||||
const providers = await this.storage.liquidityStorage.GetTrackedProviders()
|
const providers = await this.storage.liquidityStorage.GetTrackedProviders()
|
||||||
let lndTotal = 0
|
const channels = await this.lnd.GetChannelBalance()
|
||||||
let providerTotal = 0
|
let providerTotal = 0
|
||||||
console.log({ providers })
|
console.log({ providers })
|
||||||
providers.forEach(p => {
|
providers.forEach(p => {
|
||||||
if (p.provider_type === 'lnd') {
|
if (p.provider_type === 'lnPub') {
|
||||||
lndTotal += p.latest_balance
|
|
||||||
} else {
|
|
||||||
providerTotal += p.latest_balance
|
providerTotal += p.latest_balance
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -40,7 +38,7 @@ export default class Handler {
|
||||||
confirmed_chain_balance: balanceInfo.confirmedBalance,
|
confirmed_chain_balance: balanceInfo.confirmedBalance,
|
||||||
unconfirmed_chain_balance: balanceInfo.unconfirmedBalance,
|
unconfirmed_chain_balance: balanceInfo.unconfirmedBalance,
|
||||||
total_chain_balance: balanceInfo.totalBalance,
|
total_chain_balance: balanceInfo.totalBalance,
|
||||||
channels_balance: lndTotal,
|
channels_balance: Number(channels.localBalance?.sat) || 0,
|
||||||
external_balance: providerTotal
|
external_balance: providerTotal
|
||||||
}
|
}
|
||||||
const channelsEvents: Partial<ChannelBalanceEvent>[] = balanceInfo.channelsBalance.map(c => ({
|
const channelsEvents: Partial<ChannelBalanceEvent>[] = balanceInfo.channelsBalance.map(c => ({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue