Skip to content

Commit 2769def

Browse files
committed
Reuse Electrum client for transaction sync
Electrum transaction sync now reuses the client already shared by BDK and direct Electrum calls. This avoids opening a second Electrum connection and completes the reuse intended by #488. Co-Authored-By: HAL 9000
1 parent 926c18a commit 2769def

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/chain/electrum.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,11 @@ impl ElectrumRuntimeClient {
426426
);
427427
let bdk_electrum_client = Arc::new(BdkElectrumClient::new(Arc::clone(&electrum_client)));
428428
let tx_sync = Arc::new(
429-
ElectrumSyncClient::new(server_url.clone(), Arc::clone(&logger)).map_err(|e| {
430-
log_error!(logger, "Failed to connect to electrum server: {}", e);
431-
Error::ConnectionFailed
432-
})?,
429+
ElectrumSyncClient::from_client(Arc::clone(&electrum_client), Arc::clone(&logger))
430+
.map_err(|e| {
431+
log_error!(logger, "Failed to connect to electrum server: {}", e);
432+
Error::ConnectionFailed
433+
})?,
433434
);
434435
Ok(Self {
435436
electrum_client,

0 commit comments

Comments
 (0)