Skip to content

Commit

Permalink
Replace unprovable assertion by a check
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jun 19, 2024
1 parent 96e76c4 commit 050659d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions code/crates/actors/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ where

info!(%from, %validator_address, "Received vote: {:?}", signed_vote.vote);

if signed_vote.vote.height() != state.driver.height() {
warn!(
"Ignoring vote for height {}, current height: {}",
signed_vote.vote.height(),
state.driver.height()
);

return Ok(());
}

let Some(validator) = state.validator_set.get_by_address(validator_address) else {
warn!(%from, %validator_address, "Received vote from unknown validator");
return Ok(());
Expand All @@ -246,9 +256,6 @@ where
return Ok(());
}

let vote_height = signed_vote.vote.height();
assert!(vote_height == state.driver.height());

// Store the non-nil Precommits.
if signed_vote.vote.vote_type() == VoteType::Precommit
&& signed_vote.vote.value().is_val()
Expand Down

0 comments on commit 050659d

Please sign in to comment.