Skip to content

Commit dc622ca

Browse files
committed
f Reuse Esplora client
1 parent ae2297e commit dc622ca

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,17 @@ impl Builder {
229229
)
230230
.expect("Failed to setup on-chain wallet");
231231

232-
// TODO: Check that we can be sure that the Esplora client re-connects in case of failure
233-
// and and exits cleanly on drop. Otherwise we need to handle this/move it to the runtime?
234-
let blockchain = EsploraBlockchain::new(&config.esplora_server_url, BDK_CLIENT_STOP_GAP)
235-
.with_concurrency(BDK_CLIENT_CONCURRENCY);
236-
237-
let wallet = Arc::new(Wallet::new(blockchain, bdk_wallet, Arc::clone(&logger)));
238-
239232
let tx_sync = Arc::new(EsploraSyncClient::new(
240233
config.esplora_server_url.clone(),
241234
Arc::clone(&logger),
242235
));
243236

237+
let blockchain =
238+
EsploraBlockchain::from_client(tx_sync.client().clone(), BDK_CLIENT_STOP_GAP)
239+
.with_concurrency(BDK_CLIENT_CONCURRENCY);
240+
241+
let wallet = Arc::new(Wallet::new(blockchain, bdk_wallet, Arc::clone(&logger)));
242+
244243
// Step 3: Initialize Persist
245244
let persister = Arc::new(FilesystemPersister::new(ldk_data_dir.clone()));
246245

0 commit comments

Comments
 (0)