From c6c44e19cf8bad0f4459b894a3ba6aa97a7df248 Mon Sep 17 00:00:00 2001 From: Dominik Spicher Date: Fri, 9 Jun 2023 10:12:26 +0200 Subject: [PATCH] add validate domain option to electrum This has been added to bdk in https://github.com/bitcoindevkit/bdk/commit/8d4cc3920ab4177fd0f3916155671b1067285eda --- src/commands.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/commands.rs b/src/commands.rs index c8d7c0b..a1f8756 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -320,6 +320,10 @@ pub struct ElectrumOpts { default_value = "10" )] pub stop_gap: usize, + + /// Enable domain validation when connecting to Electrum servers. + #[clap(name = "VALIDATE_DOMAIN", long = "validate_domain")] + pub validate_domain: bool, } /// Options to configure Esplora backend. @@ -663,6 +667,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -707,6 +712,7 @@ mod test { "--change_descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)", "--server","ssl://electrum.blockstream.info:50002", "--stop_gap", "20", + "--validate_domain", "get_new_address"]; let cli_opts = CliOpts::from_iter(&cli_args); @@ -723,7 +729,8 @@ mod test { electrum_opts: ElectrumOpts { timeout: Some(10), server: "ssl://electrum.blockstream.info:50002".to_string(), - stop_gap: 20 + stop_gap: 20, + validate_domain: true, }, proxy_opts: ProxyOpts{ proxy: Some("127.0.0.1:9150".to_string()), @@ -927,6 +934,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1006,6 +1014,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1078,6 +1087,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1149,6 +1159,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1486,6 +1497,7 @@ mod test { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), stop_gap: 10, + validate_domain: false, }, }, };