]> Untitled Git - bdk/commitdiff
Merge bitcoindevkit/bdk#2321: feat(chain)!: classify timelocked outputs as `Immature` master github/master
authormerge-script <hello@evanlinjin.me>
Mon, 19 Oct 2026 08:06:19 +0000 (19:06 +1100)
committermerge-script <hello@evanlinjin.me>
Mon, 19 Oct 2026 08:06:19 +0000 (19:06 +1100)
ba702bd73a3a318347cc7be7afea41a3a4ea50ed test(chain): cover timelocked outputs classified as `Immature` (Dmenec)
7d7e746e03960d3e21bf5afded40eacaeb77d569 feat(chain)!: classify timelocked outputs as `Immature` (Dmenec)

Pull request description:

  ### Description

  Classifies outputs whose timelock hasn't matured yet as `Eligibility::Immature`, so they aren't counted as spendable balance. `classify_outpoints` and `balance` take a new `is_locked` predicate, evaluated on every output.

  ### Notes to the reviewers

  The timelock lives in the output's descriptor, so `CanonicalView` can't evaluate it from chain data alone. The caller passes `is_locked` instead, the same way it passes `does_taint`. The wallet side will follow in a separate `bdk_wallet` PR.

  Timelocked (CSV, CLTV) outputs share `Immature` with immature coinbase outputs, since neither is spendable by consensus. Callers that need to tell them apart can check `is_on_coinbase`. Other locked coins that aren't enforced by consensus, like frozen or reserved coins, shouldn't use `is_locked` and are expected to be handled in the wallet.

  ### Changelog notice

  Breaking: `CanonicalView::classify_outpoints` and `balance` take a new `is_locked` predicate which classifies outputs with unmet timelocks as `Immature`.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

  #### Bugfixes:

  * [x] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [ ] I'm linking the issue being fixed by this PR

ACKs for top commit:
  evanlinjin:
    ACK ba702bd73a3a318347cc7be7afea41a3a4ea50ed

Tree-SHA512: da563990f79a87e2b45286ca3913229d27f3d72fd88b1391f3e7eeba833fe9879c6e0bd690f9160cf5132d6aefe0e73f99afdc326c9d0ea599c857b316911850

1  2 
crates/chain/src/canonical.rs
crates/chain/tests/test_tx_graph_conflicts.rs
crates/electrum/tests/test_electrum.rs

Simple merge