Skip to content

feat(wallet)!: add locked balance category for unmet descriptor height-based timelocks - #538

Draft
Dmenec wants to merge 4 commits into
bitcoindevkit:masterfrom
Dmenec:feat/balance-locked
Draft

feat(wallet)!: add locked balance category for unmet descriptor height-based timelocks#538
Dmenec wants to merge 4 commits into
bitcoindevkit:masterfrom
Dmenec:feat/balance-locked

Conversation

@Dmenec

@Dmenec Dmenec commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Closes #180.

Description

Adds a locked balance category for confirmed outputs that are not yet spendable because a descriptor timelock has not matured. These outputs were previously counted as confirmed.

Notes to the reviewers

Draft unti #431 and bitcoindevkit/bdk#2246 land.

This branch is stacked on #431, which in turn needs the CanonicalView API from bdk#2246 in a published bdk_chain release before it can build.

  • Only height-based timelocks are evaluated. Time-based locks need median-time-past, which BDK does not track yet (see timestamp timelocks are not satisfied #183), so they are left as a follow-up.
  • Multi-path/complex policy conditions are evaluated with a default satisfaction.

Changelog notice

  • Added a locked balance category for confirmed outputs whose descriptor timelock has not matured. Wallet::balance now returns WalletBalance.

All Sumbissions:

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue
  • I'm linking the issue being fixed by this PR

Dmenec added 4 commits August 21, 2026 19:19
Refactor balance() to classify pending outputs by ancestry rather than keychain type.
Outputs sent to external addresses now count as trusted if their unconfirmed ancestry
belongs entirely to the wallet.
Cover how balance() classifies unconfirmed outputs by ancestry:

- Spending our own confirmed coin is trusted.
- An input we do not own is untrusted.
- Trust propagates down a chain that only spends our coins.
- Paying our change keychain does not trust a foreign input.
- Spending a foreign output is untrusted even next to a trusted change output.
- Spending an owned-but-untrusted output stays untrusted.
@Dmenec Dmenec closed this Aug 23, 2026
@Dmenec Dmenec reopened this Aug 23, 2026
@Dmenec
Dmenec marked this pull request as draft August 23, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Maybe we should mark which coins are confirmed but not yet spendable in the balance?

1 participant