What happened?
While QA-testing hardware-wallet transfer to spending (PR #1039), after:
- MAX transfer from Trezor → spending (first LSP channel),
- Coop close → savings (full channel to on-chain),
- 25% transfer to spending (opens a second channel),
the Spending balance on home briefly showed the old channel amount plus the new channel (e.g. ₿ 1,593,281 = ~1,531,123 + ~62,158), and the total header was inflated accordingly (~₿ 3,311,656). After a few regtest blocks mined, balances returned to normal (Spending ~62,158, Savings ~1,531,123).
Reproduced once in session; subsequent attempts did not reproduce (timing-sensitive).
Not believed to be hardware-wallet-specific — same DeriveBalanceStateUseCase path for any coop close + new channel while LDK still lists coop-close funds in lightning.
Expected behavior
After coop close funds appear in Savings (on-chain), they should not also count toward Spending (totalLightningSats) until LDK clears the coop-close claimable entry. Opening a second spending channel should only add the new channel balance to Spending.
Steps to Reproduce
- Regtest wallet with LSP channel(s).
- Fund spending with a large first channel (e.g. MAX from Trezor or savings → spending).
- Transfer to savings (coop close entire spending channel). Confirm savings balance updates on home.
- Immediately start another transfer to spending (e.g. 25%) to open a second channel — do not wait several minutes / many blocks.
- Complete funding until the second channel is ready (
ChannelReady).
- Open home and compare Spending + total header.
Tip: Window is narrow (~few blocks on regtest while ClaimableAwaitingConfirmations remains in LDK after on-chain sweep). Slowing block production after coop close may widen the window.
Logs / Screenshots / Recordings
Logs:
bitkit_logs_2026-06-24_08-27-21.zip
Screenshots
| State |
Screenshot |
Notes |
| Inflated spending / total |
 |
Spending ~₿ 1,593,281; total header ~₿ 3,311,656 (old coop-close amount + new second channel). |
| Corrected |
 |
Spending ~₿ 62,158; total ~₿ 1,780,533 after coop-close claimable cleared (~few blocks). |
Log signature (when bug visible):
DeriveBalanceStateUseCase: totalOnchainSats ≈ coop-close amount; totalLightningSats ≈ coop-close + new channel; balanceInTransferToSavings = 0; Active transfers: []
- LDK
lightningBalances: ClaimableAwaitingConfirmations (source: COOP_CLOSE) + new channel ClaimableOnChannelClose
- Example inflated
totalLightningSats: 1,593,281 at block height ~136343; corrected to 62,158 after height ~136348
Bitkit Version
2.3.0 (182)
Device / OS
Samsung Galaxy S22, Android 16
Reproducibility
Rarely (once or twice)
Additional context
What happened?
While QA-testing hardware-wallet transfer to spending (PR #1039), after:
the Spending balance on home briefly showed the old channel amount plus the new channel (e.g. ₿ 1,593,281 = ~1,531,123 + ~62,158), and the total header was inflated accordingly (~₿ 3,311,656). After a few regtest blocks mined, balances returned to normal (Spending ~62,158, Savings ~1,531,123).
Reproduced once in session; subsequent attempts did not reproduce (timing-sensitive).
Not believed to be hardware-wallet-specific — same
DeriveBalanceStateUseCasepath for any coop close + new channel while LDK still lists coop-close funds in lightning.Expected behavior
After coop close funds appear in Savings (on-chain), they should not also count toward Spending (
totalLightningSats) until LDK clears the coop-close claimable entry. Opening a second spending channel should only add the new channel balance to Spending.Steps to Reproduce
ChannelReady).Tip: Window is narrow (~few blocks on regtest while
ClaimableAwaitingConfirmationsremains in LDK after on-chain sweep). Slowing block production after coop close may widen the window.Logs / Screenshots / Recordings
Logs:
bitkit_logs_2026-06-24_08-27-21.zip
Screenshots
Log signature (when bug visible):
DeriveBalanceStateUseCase:totalOnchainSats≈ coop-close amount;totalLightningSats≈ coop-close + new channel;balanceInTransferToSavings= 0;Active transfers: []lightningBalances:ClaimableAwaitingConfirmations(source: COOP_CLOSE) + new channelClaimableOnChannelClosetotalLightningSats: 1,593,281 at block height ~136343; corrected to 62,158 after height ~136348Bitkit Version
2.3.0 (182)
Device / OS
Samsung Galaxy S22, Android 16
Reproducibility
Rarely (once or twice)
Additional context
TransferReposettlesCOOP_CLOSEwhen swept to on-chain; active transfer removed →DeriveBalanceStateUseCaseno longer subtracts coop-closeClaimableAwaitingConfirmationsfromtotalLightningSatswhile LDK still includes it intotalLightningBalanceSats. Second channel ready adds new balance on top → transient double on Spending line.BalanceManager.getOrphanClosedChannelBalancemay mask this; Android lacks equivalent logic.ClaimableAwaitingConfirmationswithCOOP_CLOSEsource from displayed lightning; add unit test for settled coop close + lingering claimable + second channel.