Skip to content

Conversation

@Rahamath-unnisa
Copy link

@Rahamath-unnisa Rahamath-unnisa commented Oct 20, 2025

Description:
This PR adds the validate_domain option to the Electrum client in bdk-cli.
This resolves #134 .
Changes included:

Added --validate-domain flag in command.rs.

Updated Electrum client handling in handlers.rs and utils.rs to respect the flag.

Verified functionality locally using:

RUST_LOG=debug,rusqlite=info,rustls=info cargo run --features electrum -- wallet --client-type electrum --database-type sqlite --url ssl://electrum.blockstream.info:60002 --validate-domain true --ext-descriptor "wpkh(.../*)" sync

Motivation:
Allows users to enable or disable domain validation for Electrum servers, useful for self-hosted/custom servers while preserving security by default.

Checklist:

Tested locally with Electrum client

No unrelated changes included

@va-an
Copy link
Contributor

va-an commented Oct 21, 2025

@Rahamath-unnisa pls mention in PR description that this resolves #134.

src/commands.rs Outdated
#![allow(clippy::large_enum_variant)]

#[allow(clippy::large_enum_variant)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ig this is not required.

src/handlers.rs Outdated
//!
//! This module describes all the command handling logic used by bdk-cli.
use crate::debug;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ig this is not needed either.

},
/// Syncs with the chosen blockchain server.
Sync,
/// Broadcasts a transaction to the network. Takes either a raw transaction or a PSBT to extract.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc comment should not be removed.

src/handlers.rs Outdated
.populate_tx_cache(wallet.tx_graph().full_txs().map(|tx_node| tx_node.tx));

let update = client.sync(request, batch_size, false)?;
let update = client.sync(request, batch_size, validate_domain)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ig this is not the right place to pass validate_domain looking at the defn here. I think we need to change how the client is built using this.

@Rahamath-unnisa
Copy link
Author

Hi @110CodingP,
I have made the requested cleanups in commands.rs and handlers.rs per your review comments
All changes are pushed to the validate_domain-config branch.
Please let me know if anything else is needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add validate_domain Electrum option

3 participants