Skip to content

Commit 789ac5f

Browse files
committed
f Reuse the same esplora-client again
1 parent 20dbf4d commit 789ac5f

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ rand = "0.8.5"
9292
chrono = { version = "0.4", default-features = false, features = ["clock"] }
9393
tokio = { version = "1.37", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
9494
esplora-client = { version = "0.12", default-features = false, features = ["tokio", "async-https-rustls"] }
95-
96-
# FIXME: This was introduced to decouple the `bdk_esplora` and
97-
# `lightning-transaction-sync` APIs. We should drop it as part of the upgrade
98-
# to LDK 0.2.
99-
esplora-client_0_11 = { package = "esplora-client", version = "0.11", default-features = false, features = ["tokio", "async-https-rustls"] }
10095
electrum-client = { version = "0.23.1", default-features = true }
10196
libc = "0.2"
10297
uniffi = { version = "0.28.3", features = ["build"], optional = true }

src/chain/esplora.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,6 @@ impl EsploraChainSource {
5858
tx_broadcaster: Arc<Broadcaster>, kv_store: Arc<DynStore>, config: Arc<Config>,
5959
logger: Arc<Logger>, node_metrics: Arc<RwLock<NodeMetrics>>,
6060
) -> Self {
61-
// FIXME / TODO: We introduced this to make `bdk_esplora` work separately without updating
62-
// `lightning-transaction-sync`. We should revert this as part of of the upgrade to LDK 0.2.
63-
let mut client_builder_0_11 = esplora_client_0_11::Builder::new(&server_url);
64-
client_builder_0_11 = client_builder_0_11.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS);
65-
66-
for (header_name, header_value) in &headers {
67-
client_builder_0_11 = client_builder_0_11.header(header_name, header_value);
68-
}
69-
70-
let esplora_client_0_11 = client_builder_0_11.build_async().unwrap();
71-
let tx_sync =
72-
Arc::new(EsploraSyncClient::from_client(esplora_client_0_11, Arc::clone(&logger)));
73-
7461
let mut client_builder = esplora_client::Builder::new(&server_url);
7562
client_builder = client_builder.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS);
7663

@@ -79,6 +66,8 @@ impl EsploraChainSource {
7966
}
8067

8168
let esplora_client = client_builder.build_async().unwrap();
69+
let tx_sync =
70+
Arc::new(EsploraSyncClient::from_client(esplora_client.clone(), Arc::clone(&logger)));
8271

8372
let onchain_wallet_sync_status = Mutex::new(WalletSyncStatus::Completed);
8473
let lightning_wallet_sync_status = Mutex::new(WalletSyncStatus::Completed);

0 commit comments

Comments
 (0)