diff --git a/core/src/consensus/tendermint/vote_regression_checker.rs b/core/src/consensus/tendermint/vote_regression_checker.rs index fc37907afa..5538c9ea45 100644 --- a/core/src/consensus/tendermint/vote_regression_checker.rs +++ b/core/src/consensus/tendermint/vote_regression_checker.rs @@ -13,10 +13,13 @@ impl VoteRegressionChecker { } pub fn check(&mut self, vote_on: &VoteOn) -> bool { - assert!(match vote_on.step.step { - Step::Propose | Step::Prevote | Step::Precommit => true, - _ => false, - }); + assert!( + match vote_on.step.step { + Step::Propose | Step::Prevote | Step::Precommit => true, + _ => false, + }, + "We don't vote on Commit. Check your code" + ); let monotonic = if let Some(last_vote) = &self.last_vote { match last_vote.step.cmp(&vote_on.step) { @@ -55,15 +58,15 @@ mod tests { #[test] #[should_panic] - fn test_disallow_commit() { + fn test_panic_on_commit() { let mut checker = VoteRegressionChecker::new(); let random_commit_step = VoteStep::new(100, 10, Step::Commit); let random_hash = Some(H256::random()); - assert!(checker.check(&VoteOn { + checker.check(&VoteOn { step: random_commit_step, - block_hash: random_hash - })) + block_hash: random_hash, + }); } #[test]