Conversation
Backport of bitcoindevkit#2240 to `release/chain-0.23.x`. A tx whose anchors are all in stale blocks falls through to the leftover stage of `CanonicalIter`, which marked it canonical without consulting `last_evicted`. The eviction check is done inline here because 0.23's `TxNode` has no `last_evicted` field and adding one would be breaking.
oleonardolima
self-requested a review
September 24, 2026 18:12
noahjoeris
approved these changes
Sep 25, 2026
noahjoeris
left a comment
Contributor
There was a problem hiding this comment.
ACK c211596
Thanks for the backport.
Unrelated: CI is broken and we need to update pinned deps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
It's a backport for the
bdk_chainfix introduced by #2240. If you're interested in the original fix, check the original PR for discussion/rationale.A tx whose anchors are all in blocks no longer in the best chain falls through to the leftover stage of
CanonicalIter, which made it canonical as unconfirmed without checkinglast_evicted. So a tx that was confirmed, reorged out and then evicted stayed canonical forever.Notes to the reviewers
This differs from #2240 in one way. #2240 adds
TxNode::is_evicted(), but that relies onTxNode::last_evicted, which 0.23 doesn't have. Adding the field would break anyone who constructsTxNodewith a struct literal (see the note onTxGraph::get_last_evicted). So this backport does the samelast_seen/last_evictedcheck inline inCanonicalIter, using the existingTxGraph::get_last_evicted, and adds no new API. For the same reason it leaves out #2240'stx_node_is_evictedunit test.#2240's end-to-end test
test_evicted_stale_anchored_tx_not_canonicalis ported totest_tx_graph.rsand useslist_canonical_txs, sincecanonical_viewdoesn't exist in 0.23. It fails without the fix.Changelog notice
Checklists
All Submissions: