-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hi,
I am trying to calculate the current balances of my node from the values of the csv file created by frcli audit. By balances I mean the wallet balance (on-chain balance) and the available outbound liquidity (off-chain balance) of the node.
I calculate the on-chain balance by adding all values with OnChain=true and Type!=CHANNEL_CLOSE_FEE and Type!=SWEEP_FEE. In other words:
SUM(OnChain=true) - SUM(Type=CHANNEL_CLOSE_FEE) - SUM(Type=SWEEP_FEE)
This works, and the result matches the wallet balance.
I calculate the off-chain balance (available outbound liquidity) as follows:
SUM(OnChain=false) - SUM(Type=LOCAL_CHANNEL_OPEN) - SUM(Type=CHANNEL_CLOSE) + SUM(Type=CHANNEL_CLOSE_FEE) - SUM(Type=SWEEP) + SUM(Type=SWEEP_FEE)
However, the result of this calculation does not correspond exactly to the available outgoing liquidity, but only approximately. Is this calculation correct in principle? And is it even possible to calculate the available outbound liquidity exactly from the data generated by frcli audit?
Initially, I naively calculated the sum of all values in the csv file and thought that this should correspond to the sum of off-chain and on-chain balance, but this also does not match at all.