esplora: also fix the gap limit check in the async client

This commit is contained in:
Antoine Poinsot 2023-11-20 12:00:31 +01:00
parent 2c4e90a76f
commit cb713e5b8c
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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; break;
} }
} }