From: Antoine Poinsot Date: Mon, 20 Nov 2023 11:00:31 +0000 (+0100) Subject: esplora: also fix the gap limit check in the async client X-Git-Tag: v1.0.0-alpha.3~12^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/enum.EncodeError.html?a=commitdiff_plain;h=cb713e5b8c74181518e8cfcd4095c862bc73f014;p=bdk esplora: also fix the gap limit check in the async client --- diff --git a/crates/esplora/src/async_ext.rs b/crates/esplora/src/async_ext.rs index 653a80f0..b4105053 100644 --- a/crates/esplora/src/async_ext.rs +++ b/crates/esplora/src/async_ext.rs @@ -259,7 +259,13 @@ impl EsploraAsyncExt for esplora_client::AsyncClient { } } - if last_index > last_active_index.map(|i| i.saturating_add(stop_gap as u32)) { + let last_index = last_index.expect("Must be set since handles wasn't empty."); + let past_gap_limit = if let Some(i) = last_active_index { + last_index > i.saturating_add(stop_gap as u32) + } else { + last_index >= stop_gap as u32 + }; + if past_gap_limit { break; } }