Skip to content

feat(client): allow constructing without connecting#214

Open
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:construct
Open

feat(client): allow constructing without connecting#214
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:construct

Conversation

@reez

@reez reez commented Jun 25, 2026

Copy link
Copy Markdown

Description

Attempts to address #166

Allows Client to be constructed without opening a network connection, adds Client::connect() for explicit connection and protocol negotiation, and defers automatic connection until the first Electrum API call.

Notes to Reviewers

I kept the patch intentionally small so I left out things like:

  • Adding an eager constructor like from_config_connected for callers who want the previous construct-and-connect behavior in one step.
  • Refactoring the duplicated ssl:// no-TLS check into a small helper if that feels cleaner.

Related Issues

This started for me from bdk-dart#91, where constructing an FFI backed ElectrumClient can block the Android UI thread during TCP connection and cause ANRs.

I opened bdk-ffi#1037 to address it on bdk-ffi, trying to make that blocking boundary clearer in the bindings, but I think a bdk-ffi only change still falls a bit short without an upstream change from rust-electrum-client.

So this PR is for that upstream client layer change, and is closely related to rust-electrum-client#166 where tnull asked for a way to construct an Electrum client without directly establishing a connection.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant