From f3efbdaea95ceee762c31219f14a4181bcd92eeb Mon Sep 17 00:00:00 2001 From: Rob N Date: Sat, 16 Nov 2024 10:01:48 -1000 Subject: [PATCH] fix(esplora): check recent blocks are not empty --- crates/esplora/src/async_ext.rs | 3 +++ crates/esplora/src/blocking_ext.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/crates/esplora/src/async_ext.rs b/crates/esplora/src/async_ext.rs index ca5111613..c9e167917 100644 --- a/crates/esplora/src/async_ext.rs +++ b/crates/esplora/src/async_ext.rs @@ -211,6 +211,9 @@ async fn chain_update( local_tip: &CheckPoint, anchors: &BTreeSet<(ConfirmationBlockTime, Txid)>, ) -> Result { + if latest_blocks.is_empty() { + return Ok(local_tip.clone()); + } let mut point_of_agreement = None; let mut conflicts = vec![]; for local_cp in local_tip.iter() { diff --git a/crates/esplora/src/blocking_ext.rs b/crates/esplora/src/blocking_ext.rs index b740a21db..20eba72ff 100644 --- a/crates/esplora/src/blocking_ext.rs +++ b/crates/esplora/src/blocking_ext.rs @@ -201,6 +201,9 @@ fn chain_update( local_tip: &CheckPoint, anchors: &BTreeSet<(ConfirmationBlockTime, Txid)>, ) -> Result { + if latest_blocks.is_empty() { + return Ok(local_tip.clone()); + } let mut point_of_agreement = None; let mut conflicts = vec![]; for local_cp in local_tip.iter() {