From: Riccardo Casatta Date: Tue, 17 Nov 2020 08:58:29 +0000 (+0100) Subject: Allow to set concurrency in Esplora config and optionally pass it in repl X-Git-Tag: v0.1.0~28 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/struct.SegwitCodeLengthError.html?a=commitdiff_plain;h=d7f02b8c7dc7389e7ceb5e5480bce68074466df4;p=bdk-cli Allow to set concurrency in Esplora config and optionally pass it in repl --- diff --git a/examples/repl.rs b/examples/repl.rs index 69eca92..09e75f9 100644 --- a/examples/repl.rs +++ b/examples/repl.rs @@ -95,6 +95,9 @@ fn main() { let config = match matches.value_of("esplora") { Some(base_url) => AnyBlockchainConfig::Esplora(EsploraBlockchainConfig { base_url: base_url.to_string(), + concurrency: matches + .value_of("esplora_concurrency") + .and_then(|v| v.parse::().ok()), }), None => AnyBlockchainConfig::Electrum(ElectrumBlockchainConfig { url: matches.value_of("server").unwrap().to_string(), diff --git a/src/cli.rs b/src/cli.rs index 06c11d4..350614e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -362,14 +362,23 @@ pub fn add_global_flags<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> { ); if cfg!(feature = "esplora") { - app = app.arg( - Arg::with_name("esplora") - .short("e") - .long("esplora") - .value_name("ESPLORA") - .help("Use the esplora server if given as parameter") - .takes_value(true), - ); + app = app + .arg( + Arg::with_name("esplora") + .short("e") + .long("esplora") + .value_name("ESPLORA") + .help("Use the esplora server if given as parameter") + .takes_value(true), + ) + .arg( + Arg::with_name("esplora_concurrency") + .long("esplora_concurrency") + .value_name("ESPLORA_CONCURRENCY") + .help("Concurrency of requests made to the esplora server") + .default_value("4") + .takes_value(true), + ) } if cfg!(feature = "electrum") {