Repository navigation
fix(electrum,esplora): retain only unobserved txids in evicted_ats - #2467
Open
AlphaSparrow wants to merge 1 commit into
Open
AlphaSparrow wants to merge 1 commit into
AlphaSparrow wants to merge 1 commit into
Conversation
When multiple SPKs in a sync or full_scan request expect a transaction, an SPK that does not find the transaction in its history populates evicted_ats with (txid, start_time). If another SPK in the same sync pass finds the transaction, seen_ats (or anchors) is also populated with the same timestamp. Because TxNode::is_evicted() treats last_evicted >= last_seen as evicted, emitting equal timestamps marks the transaction as evicted, causing it to be hidden from canonical_view and unconfirmed transaction lists. This prunes any transactions present in seen_ats or anchors from evicted_ats before returning the response in both bdk_electrum and bdk_esplora. Fixes bitcoindevkit#2271
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 #2271.
When multiple script pubkeys in a
SyncRequestorFullScanRequestexpect a transaction (e.g. from an unconfirmed incoming transaction or wallet history), scripts that do not observe the transaction in their history populatetx_update.evicted_atswith(txid, start_time). If another script within the same sync pass observes the transaction,tx_update.seen_ats(ortx_update.anchors) is also populated with(txid, start_time).Because
TxNode::is_evicted()evaluateslast_evicted >= last_seen, emitting equal timestamps for both seen and evicted marks the transaction as evicted, causing it to be hidden fromcanonical_viewand unconfirmed transaction listings even though it was observed during that sync pass.This PR ensures that
bdk_electrumandbdk_esplorasanitizetx_update.evicted_atsbefore returning: any transaction observed inseen_atsoranchorsduring the sync pass is removed fromevicted_ats.Notes to the reviewers
test_sync_does_not_evict_tx_seen_on_another_spkincrates/electrum/tests/test_electrum.rs. It reproduces the failure when two SPKs expect the same txid and only one observes it.TxUpdates without requiring modifications toTxGraphtie semantics inbdk_chain.Test output:
Changelog notice
Fixed
bdk_electrum: Do not include transactions observed inseen_atsoranchorsinevicted_atswithin the same sync pass. Equalseen_atandevicted_atwithin one sync hides present tx #2271bdk_esplora: Do not include transactions observed inseen_atsoranchorsinevicted_atswithin the same sync pass. Equalseen_atandevicted_atwithin one sync hides present tx #2271Checklists
All Submissions:
Bugfixes: