Skip to content

Commit

Permalink
Merge pull request #1442 from EspressoSystems/bf/fix-genesis
Browse files Browse the repository at this point in the history
Fix View 2 Timeouts
  • Loading branch information
jbearer authored May 9, 2024
2 parents c603820 + cbddc95 commit 864f791
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sequencer/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ pub trait SequencerPersistence: Sized + Send + Sync + 'static {
};
let validated_state = Some(Arc::new(ValidatedState::genesis(&state).0));

// We start from the view following the maximum view between `highest_voted_view` and
// `leaf.view_number`. This prevents double votes from starting in a view in which we had
// already voted before the restart, and prevents unnecessary catchup from starting in a
// view earlier than the anchor leaf.
let view = max(highest_voted_view, leaf.get_view_number()) + 1;
// If we are not starting from genesis, we start from the view following the maximum view
// between `highest_voted_view` and `leaf.view_number`. This prevents double votes from
// starting in a view in which we had already voted before the restart, and prevents
// unnecessary catchup from starting in a view earlier than the anchor leaf.
let mut view = max(highest_voted_view, leaf.get_view_number());
if view != ViewNumber::genesis() {
view += 1;
}

tracing::info!(?leaf, ?view, ?high_qc, "loaded consensus state");
Ok(HotShotInitializer::from_reload(
Expand Down

0 comments on commit 864f791

Please sign in to comment.