Skip to content

Commit

Permalink
feat(hubble): start_height more important than current_height
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed May 31, 2024
1 parent 378d39a commit b24d2c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hubble/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions hubble/src/tm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down

0 comments on commit b24d2c1

Please sign in to comment.