Skip to content

Commit

Permalink
fix: follow from block interval (#789)
Browse files Browse the repository at this point in the history
* fix: follow from block interval

* fix: printout
  • Loading branch information
atanmarko authored Nov 8, 2024
1 parent 981a996 commit 4b4a9df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zero/src/block_interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ impl BlockInterval {
match self {
BlockInterval::FollowFrom { start_block } => Ok(Box::pin(try_stream! {
let mut current = start_block;
loop {
yield (current, false);
loop {
let last_block_number = provider.latest_block_number().await.map_err(|e| {
anyhow!("could not retrieve latest block number from the provider: {e}")
})?;
Expand All @@ -156,7 +157,8 @@ impl BlockInterval {
current += 1;
yield (current, false);
} else {
info!("Waiting for the new blocks to be mined, requested block number: {current}, \
let next = current + 1;
info!("Waiting for the new blocks to be mined, expected block number: {next}, \
latest block number: {last_block_number}");
// No need to poll the node too frequently, waiting
// a block time interval for a block to be mined should be enough
Expand Down

0 comments on commit 4b4a9df

Please sign in to comment.