Repository navigation
fix(chain): keep first_seen when converting TxGraph to TxUpdate - #2462
Open
BarbieRajput wants to merge 1 commit into
Open
BarbieRajput wants to merge 1 commit into
BarbieRajput wants to merge 1 commit into
Conversation
`From<TxGraph> for TxUpdate` only copied `last_seen` into `seen_ats`, so a transaction's `first_seen` was lost on a round trip. Include both timestamps. `seen_ats` can hold several per transaction, and `apply_update` keeps the lowest as `first_seen` and the highest as `last_seen`. Fixes bitcoindevkit#2461
BarbieRajput
force-pushed
the
fix/tx-update-first-seen
branch
from
November 6, 2026 13:18
b28b888 to
b758a44
Compare
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
Fixes #2461.
From<TxGraph<A>> for TxUpdate<A>only copiedlast_seenintoseen_ats, so converting a graph to an update and back replacedfirst_seenwithlast_seen.This PR includes both timestamps in
seen_ats, which can already hold several per transaction.apply_updatethen restores the lowest asfirst_seenand the highest aslast_seen.Notes to the reviewers
test_tx_update_from_tx_graph_keeps_first_seenfails without this change and passes with it.cargo test -p bdk_chain --all-featurespasses.The update can now hold two
seen_atentries per tx. This is safe becauseapply_updatepasses each one toinsert_seen_at, which keeps the min asfirst_seenand the max aslast_seen. Solast_seen, which canonicalization and eviction use, is unchanged.Changelog notice
Fixed
bdk_chain:From<TxGraph> for TxUpdatenow keepsfirst_seen. fix(chain): keepfirst_seenwhen convertingTxGraphtoTxUpdate#2462Checklists
All Submissions:
Bugfixes: