From b24d2c1745b18710cf5dbb6425f5d261057c3cac Mon Sep 17 00:00:00 2001 From: cor Date: Wed, 22 May 2024 23:36:14 +0200 Subject: [PATCH] feat(hubble): start_height more important than current_height --- hubble/src/eth.rs | 4 ++-- hubble/src/tm.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hubble/src/eth.rs b/hubble/src/eth.rs index d22e070b5e..8569ef8403 100644 --- a/hubble/src/eth.rs +++ b/hubble/src/eth.rs @@ -81,8 +81,8 @@ impl Config { info!(?self.start_height, "no block found, starting at configured start height, or 0 if not defined"); self.start_height.unwrap_or_default() } else { - info!("block found, continuing at {}", block.height + 1); - block.height + info!("block {} found, starting max(start_height, {})", block.height, block.height); + block.height.max(self.start_height.unwrap_or_default()) } }) .unwrap_or_default() as u64; diff --git a/hubble/src/tm.rs b/hubble/src/tm.rs index 9e48b98b87..3fd3c70a35 100644 --- a/hubble/src/tm.rs +++ b/hubble/src/tm.rs @@ -67,8 +67,10 @@ impl Config { }; // Determine from which height we should start indexing if we haven't - // indexed any blocks yet. - let mut height = height.unwrap_or(self.start_height.unwrap_or_default().into()); + // indexed any blocks yet. If start_height > current_height, we jump to the new start height + let mut height: Height = (height.unwrap_or_default().value() as u32) + .max(self.start_height.unwrap_or_default()) + .into(); // Fast sync protocol. We sync up to latest.height - batch-size + 1 if let Some(up_to) = should_fast_sync_up_to(&client, Self::BATCH_SIZE, height).await? {