]> Untitled Git - bdk/commit
fix(chain): skip coinbase txs with a `last_seen` in canonicalization
author志宇 <hello@evanlinjin.me>
Tue, 13 Oct 2026 01:45:43 +0000 (01:45 +0000)
committer志宇 <hello@evanlinjin.me>
Tue, 13 Oct 2026 01:45:43 +0000 (01:45 +0000)
commita921c78d7aaad2c231dc5c9919e8b9b04b105954
tree76ac5068835830c2e82cb0b101942e1538e6fd8d
parent8b15e743e99a67be7d1d06a632b5f96bb7e365da
fix(chain): skip coinbase txs with a `last_seen` in canonicalization

A coinbase tx cannot be in the mempool, so a `last_seen` value on one is
bad data and must not make it canonical. Previously this was only a
`debug_assert!`, so release builds canonicalized it as unconfirmed.

A coinbase that is an ancestor of a canonical tx, or is assumed
canonical, stays canonical even if no anchor is held for it. As that is
a reachable state, `CanonicalTxOut::is_mature` no longer asserts on it
and returns `false` as maturity cannot be proven.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crates/chain/src/canonical.rs
crates/chain/src/canonical_task.rs
crates/chain/tests/test_tx_graph_conflicts.rs