Skip to content

feat(electrum): add config based client constructor#1038

Open
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:electrum-explore
Open

feat(electrum): add config based client constructor#1038
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:electrum-explore

Conversation

@reez

@reez reez commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Exploration of #1037

Add an ElectrumClientConfig record and explicit connect constructor so bindings can pass around Electrum connection settings before constructing the blocking client

Notes to the reviewers

Documentation

Changelog

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing
  • I've added exactly one changelog:* label
  • I've linked the relevant upstream docs or specs above

New Features:

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

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

@thunderbiscuit

thunderbiscuit commented Jun 23, 2026

Copy link
Copy Markdown
Member

I looked into this a bit and agree a fix would be great! I think maybe the issue is at the rust-electrum-client level however, where the constructor makes that network call instead of doing a sort of lazy connection on the first sync, or maybe adding a new method to check the server connection or something. I'll investigate this a bit more on my side too!

bitcoindevkit/rust-electrum-client#212

@reez

reez commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

I looked into this a bit and agree a fix would be great! I think maybe the issue is at the rust-electrum-client level however, where the constructor makes that network call instead of doing a sort of lazy connection on the first sync, or maybe adding a new method to check the server connection or something. I'll investigate this a bit more on my side too!

bitcoindevkit/rust-electrum-client#212

totally, my first step was figuring out what we could do here on ffi for the upcoming 3.1 (I feel like what I have stood out to me as best/clearest api), and I was still thinking thru what I thought the best idea on upstream electrum-client was so thanks for opening that issue to get it started 👍

@reez reez marked this pull request as ready for review June 23, 2026 21:40
@reez reez changed the title (draft) feat(electrum): add config based client constructor feat(electrum): add config based client constructor Jun 23, 2026

@j-kon j-kon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I like the direction of introducing ElectrumClientConfig because it gives bindings a cleaner way to pass connection settings around before constructing the blocking client.

I also like that the existing constructor now delegates to ElectrumClient::connect(...), which keeps the old API path while avoiding duplicated builder logic.

One question: should we add a small test for the new config-based constructor? Since this PR adds a new public binding-facing constructor, a focused test using the same config values as the existing constructor would help prove both paths stay equivalent.

Also, for downstream bindings, it may be useful to clarify whether validate_domain is intentionally required instead of optional with a default. The other config fields are optional, but validate_domain must always be passed, so I just want to make sure that is the intended API shape.

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants