Skip to content

Commit 818a744

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

File tree

5 files changed

+6
-26
lines changed

5 files changed

+6
-26
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@ serde_json = "1.0"
2121
thiserror = "2.0.11"
2222
tokio = { version = "1", features = ["full"] }
2323
cli-table = "0.5.0"
24-
24+
bdk_electrum = { version = "0.23.0", optional = true }
2525
# Optional dependencies
2626
bdk_bitcoind_rpc = { version = "0.21.0", features = ["std"], optional = true }
27-
bdk_electrum = { version = "0.23.0", optional = true }
27+
2828
bdk_esplora = { version = "0.22.1", features = ["async-https", "tokio"], optional = true }
2929
bdk_kyoto = { version = "0.15.1", optional = true }
3030
bdk_redb = { version = "0.1.0", optional = true }
3131
shlex = { version = "1.3.0", optional = true }
3232
tracing = "0.1.41"
3333
tracing-subscriber = "0.3.20"
34-
electrum-client = "0.24.0"
35-
3634
[features]
3735
default = ["repl", "sqlite"]
3836

src/commands.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ pub struct WalletOpts {
185185
#[cfg(feature = "electrum")]
186186
#[arg(env = "ELECTRUM_BATCH_SIZE", short = 'b', long, default_value = "10")]
187187
pub batch_size: usize,
188-
///Electrum validate domain option.
189-
#[cfg(feature = "electrum")]
190-
#[arg(env="VALIDATE_DOMAIN",long = "validate-domain", action = clap::ArgAction::Set, default_value_t = true)]
191-
pub validate_domain: bool,
192188
/// Esplora parallel requests.
193189
#[cfg(feature = "esplora")]
194190
#[arg(

src/handlers.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
618618
});
619619
match client {
620620
#[cfg(feature = "electrum")]
621-
Electrum {
622-
client,
623-
batch_size,
624-
validate_domain: _,
625-
} => {
621+
Electrum { client, batch_size } => {
626622
// Populate the electrum client's transaction cache so it doesn't re-download transaction we
627623
// already have.
628624
client
@@ -700,11 +696,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
700696

701697
match client {
702698
#[cfg(feature = "electrum")]
703-
Electrum {
704-
client,
705-
batch_size,
706-
validate_domain,
707-
} => {
699+
Electrum { client, batch_size } => {
708700
// Populate the electrum client's transaction cache so it doesn't re-download transaction we
709701
// already have.
710702
client
@@ -796,7 +788,6 @@ pub(crate) async fn handle_online_wallet_subcommand(
796788
Electrum {
797789
client,
798790
batch_size: _,
799-
validate_domain,
800791
} => client
801792
.transaction_broadcast(&tx)
802793
.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
@@ -11,13 +11,13 @@
1111
//! This module includes all the utility tools used by the App.
1212
use crate::commands::WalletOpts;
1313
use crate::error::BDKCliError as Error;
14+
use bdk_electrum::electrum_client::ConfigBuilder;
1415
#[cfg(feature = "cbf")]
1516
use bdk_kyoto::{
1617
BuilderExt, Info, LightClient, Receiver, ScanType::Sync, UnboundedReceiver, Warning,
1718
builder::Builder,
1819
};
1920
use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf};
20-
use electrum_client::ConfigBuilder;
2121
use std::fmt::Display;
2222
use std::path::{Path, PathBuf};
2323
use std::str::FromStr;
@@ -126,7 +126,6 @@ pub(crate) enum BlockchainClient {
126126
Electrum {
127127
client: Box<bdk_electrum::BdkElectrumClient<bdk_electrum::electrum_client::Client>>,
128128
batch_size: usize,
129-
validate_domain: bool,
130129
},
131130
#[cfg(feature = "esplora")]
132131
Esplora {
@@ -159,15 +158,12 @@ pub(crate) fn new_blockchain_client(
159158
let client = match wallet_opts.client_type {
160159
#[cfg(feature = "electrum")]
161160
ClientType::Electrum => {
162-
let config = ConfigBuilder::new()
163-
.validate_domain(wallet_opts.validate_domain)
164-
.build();
161+
let config = ConfigBuilder::new().build();
165162
let client = bdk_electrum::electrum_client::Client::from_config(url, config)
166163
.map(bdk_electrum::BdkElectrumClient::new)?;
167164
BlockchainClient::Electrum {
168165
client: Box::new(client),
169166
batch_size: wallet_opts.batch_size,
170-
validate_domain: wallet_opts.validate_domain,
171167
}
172168
}
173169
#[cfg(feature = "esplora")]

0 commit comments

Comments
 (0)