Skip to content

fix(chain): keep first_seen when converting TxGraph to TxUpdate - #2462

Open
BarbieRajput wants to merge 1 commit into
bitcoindevkit:masterfrom
BarbieRajput:fix/tx-update-first-seen
Open

BarbieRajput wants to merge 1 commit into
bitcoindevkit:masterfrom
BarbieRajput:fix/tx-update-first-seen

Conversation

@BarbieRajput

@BarbieRajput BarbieRajput commented Nov 6, 2026 •

Copy link
Copy Markdown

Description

Fixes #2461.

From<TxGraph<A>> for TxUpdate<A> only copied last_seen into seen_ats, so converting a graph to an update and back replaced first_seen with last_seen.

This PR includes both timestamps in seen_ats, which can already hold several per transaction. apply_update then restores the lowest as first_seen and the highest as last_seen.

Notes to the reviewers

test_tx_update_from_tx_graph_keeps_first_seen fails without this change and passes with it. cargo test -p bdk_chain --all-features passes.

The update can now hold two seen_at entries per tx. This is safe because apply_update passes each one to insert_seen_at, which keeps the min as first_seen and the max as last_seen. So last_seen, which canonicalization and eviction use, is unchanged.

Changelog notice

Fixed

Checklists

All Submissions:

Bugfixes:

  • 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

@BarbieRajput
BarbieRajput requested a review from a team as a code owner November 6, 2026 13:15
@github-project-automation github-project-automation Bot moved this to Triage in BDK Chain Nov 6, 2026
`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
BarbieRajput force-pushed the fix/tx-update-first-seen branch from b28b888 to b758a44 Compare November 6, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

chain: From<TxGraph> for TxUpdate drops first_seen

1 participant