From 2f82cf986a7ba59ab19d8312c7014f05c736fbac Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Mon, 12 Oct 2026 12:46:38 +0200 Subject: [PATCH] Fix stop-gap recovery test assumptions Recent BDK clients count the full-scan stop gap only after the wallet's revealed range. The recovery test funded an address within that range plus the default gap, so its zero-balance assertion failed. Place the funds beyond the startup address pool and default gap, allowing for batched requests. Keep the configured gap wide enough for older clients too, preserving both recovery assertions. Co-Authored-By: HAL 9000 --- tests/integration_tests_rust.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index f58cad6904..c5fc3ee882 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -1759,11 +1759,12 @@ async fn onchain_wallet_full_scan_stop_gap_recovers_far_esplora_and_electrum_fun async fn do_onchain_wallet_full_scan_stop_gap_recovers_far_funds( chain_source: TestChainSource<'_>, bitcoind: &BitcoinD, electrsd: &ElectrsD, ) { - let configured_stop_gap = DEFAULT_FULL_SCAN_STOP_GAP + 5; - // Handouts consume the pool oldest revealed index first, so the last of N handouts sits at - // index N - 1, behind N - 1 revealed-but-unused scripts. Choose N so the funded address lies - // beyond the default stop gap's reach but within the configured gap's. - let handout_count = DEFAULT_FULL_SCAN_STOP_GAP + 3; + // Fresh nodes reveal ADDRESS_POOL_SIZE scripts before syncing. BDK applies the stop gap + // beyond that revealed range, so fund an address past both the pool and the default gap. + // Leave room for Esplora's final batch of concurrent requests to overshoot the gap. + let handout_count = ADDRESS_POOL_SIZE + DEFAULT_FULL_SCAN_STOP_GAP + 5; + // Also cover older BDK clients, which count revealed-but-unused scripts toward the gap. + let configured_stop_gap = handout_count; let address_source_config = random_config(); let node_entropy = address_source_config.node_entropy;