Ben Franklin's Kite asked 13 days ago

How can we check the number of local sats in the channel?

When a peer closes a channel, how can we check the number of local sats in the channel at the time of closing in order to reconcile with our on-chain wallet? The node I'm referencing is in the process of closing over 400 channels per Amboss.

LN+ answered 13 days ago

Before it's closed you can see the balance on each channel in Thundehub or RTL. If you mean after the closing happened, I don't think there is a log of that available in Thunderhub or RTL. Your client is checking as soon it detects the channel closing transaction. If the other party were to close with a state that is not the latest your client will issue a punishing transaction and you get the entire balance to your on-chain wallet.


LNDB4TIME answered 13 days ago

For RTL, Click "Peers/Channels", "Closed", then your local balance for each closed channel should be listed under "Settled Balance".

For LND run:
$ lncli closedchannels
"settled_balance" shows your local balance when the channel closed.

You can find this in channel.go where the settled balance is defined as the local balance at the time of channel closure.
func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, signer input.Signer,
 | 	commitSpend *chainntnfs.SpendDetail,
 | 	remoteCommit channeldb.ChannelCommitment,
 | 	commitPoint *btcec.PublicKey) (*UnilateralCloseSummary, error) {
    ...
    closeSummary := channeldb.ChannelCloseSummary{
        ...
        SettledBalance:          btcutil.Amount(localBalance)
        ...
    }
    ...
}


Ben Franklin's Kite answered 12 days ago

Thank you both. I was searching for a log of the balance at the time of closing after the channel had been closed. It sounds like a moot issue if there is an automatic punishing transaction if the final state is not used. 

Please sign in to post answers.