Skip to content

Commit c697136

Browse files
fix(electrum): always enable domain validation internally
Signed-off-by: Rahamath-Unnisa <rahamathunnisa287@gmail.com>
1 parent 4dafc13 commit c697136

File tree

5 files changed

+7
-24
lines changed

5 files changed

+7
-24
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ serde_json = "1.0"
2222
thiserror = "2.0.18"
2323
tokio = { version = "1", features = ["full"] }
2424
cli-table = "0.5.0"
25-
tracing = "0.1.44"
26-
tracing-subscriber = "0.3.20"
27-
toml = "1.1.0"
28-
serde= {version = "1.0", features = ["derive"]}
2925

26+
bdk_electrum = { version = "0.23.0", optional = true }
3027
# Optional dependencies
3128
bdk_bitcoind_rpc = { version = "0.21.0", features = ["std"], optional = true }
32-
bdk_electrum = { version = "0.23.2", optional = true }
29+
3330
bdk_esplora = { version = "0.22.1", features = ["async-https", "tokio"], optional = true }
3431
bdk_kyoto = { version = "0.15.4", optional = true }
3532
bdk_redb = { version = "0.1.1", optional = true }

src/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pub struct WalletOpts {
269269
#[cfg(feature = "electrum")]
270270
#[arg(env = "ELECTRUM_BATCH_SIZE", short = 'b', long, default_value = "10")]
271271
pub batch_size: usize,
272-
272+
273273
/// Esplora parallel requests.
274274
#[cfg(feature = "esplora")]
275275
#[arg(

src/handlers.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
634634
});
635635
match client {
636636
#[cfg(feature = "electrum")]
637-
Electrum {
638-
client,
639-
batch_size,
640-
validate_domain: _,
641-
} => {
637+
Electrum { client, batch_size } => {
642638
// Populate the electrum client's transaction cache so it doesn't re-download transaction we
643639
// already have.
644640
client
@@ -716,11 +712,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
716712

717713
match client {
718714
#[cfg(feature = "electrum")]
719-
Electrum {
720-
client,
721-
batch_size,
722-
validate_domain,
723-
} => {
715+
Electrum { client, batch_size } => {
724716
// Populate the electrum client's transaction cache so it doesn't re-download transaction we
725717
// already have.
726718
client
@@ -813,7 +805,6 @@ pub(crate) async fn handle_online_wallet_subcommand(
813805
Electrum {
814806
client,
815807
batch_size: _,
816-
validate_domain,
817808
} => client
818809
.transaction_broadcast(&tx)
819810
.map_err(|e| Error::Generic(e.to_string()))?,

src/utils.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use crate::commands::WalletOpts;
1414
use crate::error::BDKCliError as Error;
15+
use bdk_electrum::electrum_client::ConfigBuilder;
1516
#[cfg(feature = "cbf")]
1617
use bdk_kyoto::{
1718
BuilderExt, Info, LightClient, Receiver, ScanType::Sync, UnboundedReceiver, Warning,
@@ -20,7 +21,6 @@ use bdk_kyoto::{
2021

2122

2223
use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf};
23-
use electrum_client::ConfigBuilder;
2424
use std::fmt::Display;
2525
use std::path::{Path, PathBuf};
2626
use std::str::FromStr;
@@ -136,7 +136,6 @@ pub(crate) enum BlockchainClient {
136136
Electrum {
137137
client: Box<bdk_electrum::BdkElectrumClient<bdk_electrum::electrum_client::Client>>,
138138
batch_size: usize,
139-
validate_domain: bool,
140139
},
141140
#[cfg(feature = "esplora")]
142141
Esplora {
@@ -177,15 +176,12 @@ pub(crate) fn new_blockchain_client(
177176
let client = match wallet_opts.client_type {
178177
#[cfg(feature = "electrum")]
179178
ClientType::Electrum => {
180-
let config = ConfigBuilder::new()
181-
.validate_domain(wallet_opts.validate_domain)
182-
.build();
179+
let config = ConfigBuilder::new().build();
183180
let client = bdk_electrum::electrum_client::Client::from_config(url, config)
184181
.map(bdk_electrum::BdkElectrumClient::new)?;
185182
BlockchainClient::Electrum {
186183
client: Box::new(client),
187184
batch_size: wallet_opts.batch_size,
188-
validate_domain: wallet_opts.validate_domain,
189185
}
190186
}
191187
#[cfg(feature = "esplora")]

0 commit comments

Comments
 (0)