Skip to content

Conversation

@t-bast
Copy link
Member

@t-bast t-bast commented Jun 25, 2025

Our node balance computation was simplified in #3096, but it is now too simplistic during closing, where some of the balance may be duplicated between the off-chain part and unconfirmed or recently confirmed transactions.

We deduplicate those by not counting in our off-chain balance of closing channels outputs that are spent by an unconfirmed or recently confirmed transaction that we've included in our on-chain balance.

Fixes #3098

Our node balance computation was simplified in #3096, but it is now too
simplistic during closing, where some of the balance may be duplicated
between the off-chain part and unconfirmed or recently confirmed
transactions.

We deduplicate those by not counting in our off-chain balance of closing
channels outputs that are spent by an unconfirmed or recently confirmed
transaction that we've included in our on-chain balance.

Fixes #3098
@t-bast t-bast requested a review from pm47 June 25, 2025 12:37
Our on-chain utxos can be spent as soon as they have 1 confirmation.
When that happens, we still need to deduplicate the corresponding
utxo from our off-chain balance, but it doesn't appear in our list
of unspent utxos. We fix that by fetching the last blocks and scan
all utxos that have been spent in those blocks, which indicates that
they must be ignored from our off-chain balance. Once they reach min
depth, the off-chain balance won't include them because they will be
stored in the `irrevocablySpent` set in the channel data.
@t-bast t-bast requested a review from pm47 July 15, 2025 15:55
@t-bast t-bast merged commit a307b70 into master Jul 16, 2025
1 of 3 checks passed
@t-bast t-bast deleted the check-balance-tx-pruning branch July 16, 2025 08:00
t-bast added a commit that referenced this pull request Jul 16, 2025
This was introduced in #3119
t-bast added a commit that referenced this pull request Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unconfirmed transaction pruning when computing force-close balance

3 participants