From: rajarshimaitra Date: Thu, 26 Aug 2021 09:54:51 +0000 (+0530) Subject: Update electrum cli args X-Git-Tag: v0.3.0~20 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/struct.CommandStringError.html?a=commitdiff_plain;h=1c8127f16b953b4131f0dd95902b7e32144f9962;p=bdk-cli Update electrum cli args BDK v0.10.0 adds a stop_gap parameter to electrum config. --- diff --git a/src/bdk_cli.rs b/src/bdk_cli.rs index 3760f16..b8a7f55 100644 --- a/src/bdk_cli.rs +++ b/src/bdk_cli.rs @@ -122,6 +122,7 @@ where socks5: wallet_opts.proxy_opts.proxy.clone(), retry: wallet_opts.proxy_opts.retries, timeout: wallet_opts.electrum_opts.timeout, + stop_gap: wallet_opts.electrum_opts.stop_gap, }); #[cfg(feature = "esplora")] diff --git a/src/lib.rs b/src/lib.rs index 1aa1110..8e4dcdf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -78,6 +78,7 @@ //! socks5: wallet_opts.proxy_opts.proxy, //! retry: wallet_opts.proxy_opts.retries, //! timeout: None, +//! stop_gap: 10 //! }); //! //! let wallet = Wallet::new( @@ -178,6 +179,7 @@ use bdk::{FeeRate, KeychainKind, Wallet}; /// electrum_opts: ElectrumOpts { /// timeout: None, /// server: "ssl://electrum.blockstream.info:60002".to_string(), +/// stop_gap: 10 /// }, /// #[cfg(feature = "esplora")] /// esplora_opts: EsploraOpts { @@ -322,6 +324,7 @@ pub enum WalletSubCommand { /// electrum_opts: ElectrumOpts { /// timeout: None, /// server: "ssl://electrum.blockstream.info:60002".to_string(), +/// stop_gap: 10 /// }, /// #[cfg(feature = "esplora")] /// esplora_opts: EsploraOpts { @@ -447,6 +450,15 @@ pub struct ElectrumOpts { default_value = "ssl://electrum.blockstream.info:60002" )] pub server: String, + + /// Stop searching addresses for transactions after finding an unused gap of this length. + #[structopt( + name = "STOP_GAP", + long = "stop_gap", + short = "g", + default_value = "10" + )] + pub stop_gap: usize, } /// Esplora options @@ -1113,7 +1125,8 @@ mod test { #[cfg(feature = "electrum")] electrum_opts: ElectrumOpts { timeout: None, - server: "ssl://electrum.blockstream.info:60002".to_string() + server: "ssl://electrum.blockstream.info:60002".to_string(), + stop_gap: 10, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1148,6 +1161,7 @@ mod test { "--descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)", "--change_descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)", "--server","ssl://electrum.blockstream.info:50002", + "--stop_gap", "20", "get_new_address"]; let cli_opts = CliOpts::from_iter(&cli_args); @@ -1164,6 +1178,7 @@ mod test { electrum_opts: ElectrumOpts { timeout: Some(10), server: "ssl://electrum.blockstream.info:50002".to_string(), + stop_gap: 20 }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1314,6 +1329,7 @@ mod test { electrum_opts: ElectrumOpts { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), + stop_gap: 10, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1380,6 +1396,7 @@ mod test { electrum_opts: ElectrumOpts { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), + stop_gap: 10, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { @@ -1438,6 +1455,7 @@ mod test { electrum_opts: ElectrumOpts { timeout: None, server: "ssl://electrum.blockstream.info:60002".to_string(), + stop_gap: 10, }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts {