Skip to content

Commit 6a641fc

Browse files
committed
f Reuse electrum-client
1 parent f9b7322 commit 6a641fc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/chain/electrum.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const ELECTRUM_CLIENT_TIMEOUT_SECS: u8 = 20;
4444

4545
pub(crate) struct ElectrumRuntimeClient {
4646
electrum_client: Arc<ElectrumClient>,
47-
bdk_electrum_client: Arc<BdkElectrumClient<ElectrumClient>>,
47+
bdk_electrum_client: Arc<BdkElectrumClient<Arc<ElectrumClient>>>,
4848
tx_sync: Arc<ElectrumSyncClient<Arc<Logger>>>,
4949
runtime: Arc<tokio::runtime::Runtime>,
5050
config: Arc<Config>,
@@ -67,12 +67,7 @@ impl ElectrumRuntimeClient {
6767
Error::ConnectionFailed
6868
})?,
6969
);
70-
let electrum_client_2 =
71-
ElectrumClient::from_config(&server_url, electrum_config).map_err(|e| {
72-
log_error!(logger, "Failed to connect to electrum server: {}", e);
73-
Error::ConnectionFailed
74-
})?;
75-
let bdk_electrum_client = Arc::new(BdkElectrumClient::new(electrum_client_2));
70+
let bdk_electrum_client = Arc::new(BdkElectrumClient::new(Arc::clone(&electrum_client)));
7671
let tx_sync = Arc::new(
7772
ElectrumSyncClient::new(server_url.clone(), Arc::clone(&logger)).map_err(|e| {
7873
log_error!(logger, "Failed to connect to electrum server: {}", e);

0 commit comments

Comments
 (0)