feat: stream transactions and progress during sync#2242
Open
ANAMASGARD wants to merge 1 commit into
Open
Conversation
Add .on_event() API with PartialUpdate and AnchorsResolved events, TxUpdate::drain_since() for safe incremental application, and wire emission into Electrum and Esplora backends. Addresses bitcoindevkit#2202.
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.
Closes #2202
Description
Adds incremental sync progress and transaction streaming to Electrum and Esplora backends.
Wallets can register
.on_event()onSyncRequest/FullScanRequestto receive:PartialUpdate(TxUpdate)— newly discovered txs/metadata at fetch boundariesAnchorsResolved(TxUpdate)— anchor-only delta after Electrum resolves confirmation proofsItemStarted/SpkStarted— progress events (.inspect()is sugar over these)TxUpdate::drain_since()destructively moves data out of the working buffer at each emission boundary. When events consume everything,response.tx_updateis naturally empty — applying it at the end is a safe no-op (no double-apply footgun).Consumer contract:
Emission points:
AnchorsResolvedafterbatch_fetch_anchorsExisting
sync/full_scansignatures are unchanged (additive API).Notes to the reviewers
.inspect()now routes through.on_event()internally (single reporter path); progress-only users are unaffected unless they also call.on_event().emit_partial_updatesdefaults tofalse— draining only happens when.on_event()is used.PartialUpdateintentionally lack anchors untilAnchorsResolved; seesync_defers_anchors_until_resolvedtest.EmitPartialtrait on the concrete request (notdynacross.await) to satisfySend.Changelog notice
SyncRequestEvent,FullScanRequestEvent,FullScanProgress, andTxUpdateCursortypes.SyncRequestBuilder::on_event()andFullScanRequestBuilder::on_event().TxUpdate::drain_since()for incremental delta extraction.PartialUpdateevents during sync/full_scan when.on_event()is registered.Checklists
All Submissions:
New Features:
Bugfixes: