Skip to content

Commit 976373d

Browse files
committed
add validate domain option to electrum
This has been added to bdk in bitcoindevkit/bdk@8d4cc39
1 parent eef97ad commit 976373d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog info is also documented on the [GitHub releases](https://github.com/bi
44
page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
55

66
## [Unreleased]
7+
- Added the `validate_domain` option to Electrum arguments.
78

89
## [0.27.1]
910
- Added hardware signers through the use of HWI.

src/commands.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ pub struct ElectrumOpts {
320320
default_value = "10"
321321
)]
322322
pub stop_gap: usize,
323+
324+
/// Enable domain validation when connecting to Electrum servers.
325+
#[clap(
326+
name = "VALIDATE_DOMAIN",
327+
long = "validate_domain",
328+
default_value = "true"
329+
)]
330+
pub validate_domain: bool,
323331
}
324332

325333
/// Options to configure Esplora backend.
@@ -663,6 +671,7 @@ mod test {
663671
timeout: None,
664672
server: "ssl://electrum.blockstream.info:60002".to_string(),
665673
stop_gap: 10,
674+
validate_domain: true,
666675
},
667676
#[cfg(feature = "esplora")]
668677
esplora_opts: EsploraOpts {
@@ -723,7 +732,8 @@ mod test {
723732
electrum_opts: ElectrumOpts {
724733
timeout: Some(10),
725734
server: "ssl://electrum.blockstream.info:50002".to_string(),
726-
stop_gap: 20
735+
stop_gap: 20,
736+
validate_domain: true,
727737
},
728738
proxy_opts: ProxyOpts{
729739
proxy: Some("127.0.0.1:9150".to_string()),
@@ -927,6 +937,7 @@ mod test {
927937
timeout: None,
928938
server: "ssl://electrum.blockstream.info:60002".to_string(),
929939
stop_gap: 10,
940+
validate_domain: true,
930941
},
931942
#[cfg(feature = "esplora")]
932943
esplora_opts: EsploraOpts {
@@ -1006,6 +1017,7 @@ mod test {
10061017
timeout: None,
10071018
server: "ssl://electrum.blockstream.info:60002".to_string(),
10081019
stop_gap: 10,
1020+
validate_domain: true,
10091021
},
10101022
#[cfg(feature = "esplora")]
10111023
esplora_opts: EsploraOpts {
@@ -1078,6 +1090,7 @@ mod test {
10781090
timeout: None,
10791091
server: "ssl://electrum.blockstream.info:60002".to_string(),
10801092
stop_gap: 10,
1093+
validate_domain: true,
10811094
},
10821095
#[cfg(feature = "esplora")]
10831096
esplora_opts: EsploraOpts {
@@ -1149,6 +1162,7 @@ mod test {
11491162
timeout: None,
11501163
server: "ssl://electrum.blockstream.info:60002".to_string(),
11511164
stop_gap: 10,
1165+
validate_domain: true,
11521166
},
11531167
#[cfg(feature = "esplora")]
11541168
esplora_opts: EsploraOpts {
@@ -1486,6 +1500,7 @@ mod test {
14861500
timeout: None,
14871501
server: "ssl://electrum.blockstream.info:60002".to_string(),
14881502
stop_gap: 10,
1503+
validate_domain: true,
14891504
},
14901505
},
14911506
};

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub(crate) fn new_blockchain(
400400
retry: wallet_opts.proxy_opts.retries,
401401
timeout: wallet_opts.electrum_opts.timeout,
402402
stop_gap: wallet_opts.electrum_opts.stop_gap,
403-
validate_domain: true,
403+
validate_domain: wallet_opts.electrum_opts.validate_domain,
404404
})
405405
};
406406

0 commit comments

Comments
 (0)