feat(electrum): add config based client constructor#1038
Conversation
|
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! |
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 👍 |
j-kon
left a comment
There was a problem hiding this comment.
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.
Description
Exploration of #1037
Add an
ElectrumClientConfigrecord and explicit connect constructor so bindings can pass around Electrum connection settings before constructing the blocking clientNotes to the reviewers
Documentation
bdk_walletbitcoinuniffiChangelog
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingchangelog:*labelNew Features:
Bugfixes: