Skip to content

Commit

Permalink
fix(listener): next epoch calculation (#2371)
Browse files Browse the repository at this point in the history
  • Loading branch information
justprosh authored Sep 12, 2024
1 parent 05cf711 commit 2d29b30
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/chain-listener/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,10 +1118,12 @@ impl ChainListener {

fn is_epoch_ending(&self) -> bool {
let window = Uint::from(self.listener_config.epoch_end_window.as_secs());
let next_epoch_start =
self.init_timestamp + self.epoch_duration * (self.current_epoch - Uint::from(1));
let next_epoch_start = self.init_timestamp + self.epoch_duration * self.current_epoch;
tracing::debug!(target: "chain-listener", "Next epoch start: {}, last observed block timestamp: {}", next_epoch_start, self.last_observed_block_timestamp);
next_epoch_start - self.last_observed_block_timestamp < window
next_epoch_start
.checked_sub(self.last_observed_block_timestamp)
.unwrap_or(Uint::ZERO)
< window
}

async fn poll_proofs(&mut self) -> eyre::Result<()> {
Expand Down

0 comments on commit 2d29b30

Please sign in to comment.