Skip to content

Commit 5bfc022

Browse files
committed
f Reuse the same esplora-client again
1 parent 7e23bf2 commit 5bfc022

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
@@ -93,11 +93,6 @@ rand = "0.8.5"
9393
chrono = { version = "0.4", default-features = false, features = ["clock"] }
9494
tokio = { version = "1.37", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
9595
esplora-client = { version = "0.12", default-features = false, features = ["tokio", "async-https-rustls"] }
96-
97-
# FIXME: This was introduced to decouple the `bdk_esplora` and
98-
# `lightning-transaction-sync` APIs. We should drop it as part of the upgrade
99-
# to LDK 0.2.
100-
esplora-client_0_11 = { package = "esplora-client", version = "0.11", default-features = false, features = ["tokio", "async-https-rustls"] }
10196
electrum-client = { version = "0.24.0", default-features = true }
10297
libc = "0.2"
10398
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
@@ -57,19 +57,6 @@ impl EsploraChainSource {
5757
kv_store: Arc<DynStore>, config: Arc<Config>, logger: Arc<Logger>,
5858
node_metrics: Arc<RwLock<NodeMetrics>>,
5959
) -> Self {
60-
// FIXME / TODO: We introduced this to make `bdk_esplora` work separately without updating
61-
// `lightning-transaction-sync`. We should revert this as part of of the upgrade to LDK 0.2.
62-
let mut client_builder_0_11 = esplora_client_0_11::Builder::new(&server_url);
63-
client_builder_0_11 = client_builder_0_11.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS);
64-
65-
for (header_name, header_value) in &headers {
66-
client_builder_0_11 = client_builder_0_11.header(header_name, header_value);
67-
}
68-
69-
let esplora_client_0_11 = client_builder_0_11.build_async().unwrap();
70-
let tx_sync =
71-
Arc::new(EsploraSyncClient::from_client(esplora_client_0_11, Arc::clone(&logger)));
72-
7360
let mut client_builder = esplora_client::Builder::new(&server_url);
7461
client_builder = client_builder.timeout(DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS);
7562

@@ -78,6 +65,8 @@ impl EsploraChainSource {
7865
}
7966

8067
let esplora_client = client_builder.build_async().unwrap();
68+
let tx_sync =
69+
Arc::new(EsploraSyncClient::from_client(esplora_client.clone(), Arc::clone(&logger)));
8170

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

0 commit comments

Comments
 (0)