Skip to content

Commit 942e5c1

Browse files
committed
fix(esplora): check recent blocks are not empty
1 parent b8c736c commit 942e5c1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

crates/esplora/src/async_ext.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ async fn fetch_block(
188188
return Ok(Some(hash));
189189
}
190190

191+
if latest_blocks.is_empty() {
192+
return Ok(None);
193+
}
191194
// We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
192195
// tip is used to signal for the last-synced-up-to-height.
193196
let &tip_height = latest_blocks

crates/esplora/src/blocking_ext.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ fn fetch_block(
178178
return Ok(Some(hash));
179179
}
180180

181+
if latest_blocks.is_empty() {
182+
return Ok(None);
183+
}
181184
// We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
182185
// tip is used to signal for the last-synced-up-to-height.
183186
let &tip_height = latest_blocks

0 commit comments

Comments
 (0)