Skip to content

Conversation

@ShigrafS
Copy link

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 ElectrumSync helper and SyncOptions, which wrap existing SyncRequest and FullScanRequest flows into a single, ergonomic call while preserving the existing BdkElectrumClient cache and behavior.

Concretely, this PR:

  • Adds ElectrumSync, a lightweight helper for performing Electrum syncs using a shared BdkElectrumClient
  • Introduces SyncOptions to configure fast sync vs full scan, stop gap, batch size, and prevout fetching
  • Exports the helper from bdk_electrum for reuse
  • Adds an example demonstrating a “one-liner” full scan and fast sync using public Electrum servers

The 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:

  • The helper preserves the BdkElectrumClient and its cache across sync calls, avoiding the performance regressions discussed previously.
  • The API is intentionally small and avoids introducing a fluent/builder-style abstraction that would expand the public surface area.
  • The helper does not mutate wallet state; instead, it returns the existing chain and transaction updates so that application code remains in control of how updates are applied.

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

  • Added ElectrumSync and SyncOptions helpers to simplify Electrum wallet synchronization
  • Added an example demonstrating one-liner Electrum sync usage

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Provide a one liner to sync with electrum

2 participants