From eb9e6ec0b431433529743e0837b2a29cbd71d811 Mon Sep 17 00:00:00 2001 From: emma31-dev Date: Sun, 25 Oct 2026 16:13:48 +0100 Subject: [PATCH 1/2] Allow overriding Esplora scan parallelism Make the parallel request option Esplora-only and optional, using the wallet's configured value unless overridden. Limit stop-gap to Electrum and Esplora. --- src/handlers/online.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/handlers/online.rs b/src/handlers/online.rs index 25baf889..8c2cde94 100644 --- a/src/handlers/online.rs +++ b/src/handlers/online.rs @@ -82,10 +82,14 @@ impl OnlineWalletSubCommand { #[derive(Parser, Debug, PartialEq, Clone, Eq)] pub struct FullScanCommand { /// Stop searching addresses for transactions after finding an unused gap of this length. + #[cfg(any(feature = "electrum", feature = "esplora"))] #[arg(env = "STOP_GAP", long = "scan-stop-gap", default_value = "20")] stop_gap: usize, - #[clap(long, default_value = "5")] - pub parallel_request: usize, + + /// Override the Esplora wallet's configured parallel request count. + #[cfg(feature = "esplora")] + #[arg(long)] + pub parallel_request: Option, } #[cfg(any( @@ -132,7 +136,11 @@ impl AsyncAppCommand>> for FullScanCommand { parallel_requests, } => { let update = client - .full_scan(request, self.stop_gap, *parallel_requests) + .full_scan( + request, + self.stop_gap, + self.parallel_request.unwrap_or(*parallel_requests), + ) .await .map_err(|e| *e)?; let events = wallet.apply_update_events(update)?; From 922dd649303e3a29652973b431619c5fd11d2424 Mon Sep 17 00:00:00 2001 From: emma31-dev Date: Sun, 25 Oct 2026 16:54:44 +0100 Subject: [PATCH 2/2] test(full-scan): cover backend options and update changelog --- CHANGELOG.md | 1 + src/handlers/online.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b68802b3..73f0e417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details. - Routed compact filter (cbf) traffic through the configured SOCKS5 proxy - Rejected `--proxy` on the `rpc` backend, and unsupported proxy options (`--proxy_auth`, `--timeout`) on the `rpc` and `cbf` backends, instead of silently ignoring them - Fixed `compile` rejecting policies that are valid for the requested script type +- Gated full-scan `stop_gap` to Electrum and Esplora, and made the Esplora parallel-request override optional ## [4.0.0] diff --git a/src/handlers/online.rs b/src/handlers/online.rs index 8c2cde94..c8bb23f5 100644 --- a/src/handlers/online.rs +++ b/src/handlers/online.rs @@ -204,6 +204,39 @@ impl AsyncAppCommand>> for FullScanCommand { } } +#[cfg(test)] +mod tests { + use super::FullScanCommand; + use clap::Parser; + + #[test] + fn stop_gap_is_gated_to_supported_backends() { + #[cfg(any(feature = "electrum", feature = "esplora"))] + { + let default = FullScanCommand::try_parse_from(["bdk-cli"]).unwrap(); + assert_eq!(default.stop_gap, 20); + let custom = + FullScanCommand::try_parse_from(["bdk-cli", "--scan-stop-gap", "42"]).unwrap(); + assert_eq!(custom.stop_gap, 42); + } + + #[cfg(not(any(feature = "electrum", feature = "esplora")))] + assert!(FullScanCommand::try_parse_from(["bdk-cli", "--scan-stop-gap", "42"]).is_err()); + } + + #[cfg(feature = "esplora")] + #[test] + fn parallel_request_overrides_or_uses_wallet_config() { + let configured = 7; + let default = FullScanCommand::try_parse_from(["bdk-cli"]).unwrap(); + assert_eq!(default.parallel_request.unwrap_or(configured), configured); + + let custom = + FullScanCommand::try_parse_from(["bdk-cli", "--parallel-request", "2"]).unwrap(); + assert_eq!(custom.parallel_request.unwrap_or(configured), 2); + } +} + #[derive(Parser, Debug, PartialEq, Eq, Clone)] pub struct SyncCommand;