feat: add one-liner wallet sync API with ElectrumSync #2094
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 #1974
Description
This PR introduces a small, focused helper abstraction to reduce the boilerplate required to synchronize a wallet index with an Electrum server, addressing the usability concerns raised in #1974.
The main addition is the
ElectrumSynchelper andSyncOptions, which wrap existingSyncRequestandFullScanRequestflows into a single, ergonomic call while preserving the existingBdkElectrumClientcache and behavior.Concretely, this PR:
ElectrumSync, a lightweight helper for performing Electrum syncs using a sharedBdkElectrumClientSyncOptionsto configure fast sync vs full scan, stop gap, batch size, and prevout fetchingbdk_electrumfor reuseThe helper is intentionally minimal and builds directly on top of existing BDK primitives without introducing a new builder API or altering wallet abstractions.
Notes to the reviewers
This PR is informed by the feedback and architectural concerns raised in #2059.
In particular:
BdkElectrumClientand its cache across sync calls, avoiding the performance regressions discussed previously.The goal of this PR is to provide a convenience layer that demonstrates a simplified sync flow while remaining close to existing abstractions.
Feedback on whether this belongs as a public helper or should instead live purely as an example is very welcome.
Changelog notice
ElectrumSyncandSyncOptionshelpers to simplify Electrum wallet synchronizationChecklists
All Submissions:
New Features:
Bugfixes: