Skip to content

Commit

Permalink
clarifies why a test case is valid under the new implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Oct 10, 2024
1 parent 9f11257 commit aabf2c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions consensus/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestMempoolProgressInHigherRound(t *testing.T) {
timeoutCh := subscribe(cs.eventBus, types.EventQueryTimeoutPropose)
cs.setProposal = func(proposal *types.Proposal) error {
if cs.Height == 2 && cs.Round == 0 {
// dont set the proposal in round 0 so we timeout and
// don't set the proposal in round 0 so we timeout and
// go to next round
cs.Logger.Info("Ignoring set proposal at height 2, round 0")
return nil
Expand All @@ -91,7 +91,12 @@ func TestMempoolProgressInHigherRound(t *testing.T) {
round = 0

ensureNewRound(newRoundCh, height, round) // first round at next height
deliverTxsRange(cs, 0, 1) // we deliver txs, but dont set a proposal so we get the next round
deliverTxsRange(cs, 0, 1) // we deliver txs, but don't set a proposal so we get the next round
// The following line checks if we proceed to the next round after cs.config.TimeoutPropose.Nanoseconds().
// In the versioned timeout implementation, the timeout propose is version-dependent.
// However, in this test case, cs is created with an empty previous state,
// so there's no timeout propose in the previous state.
// Therefore, we fall back to the timeout propose in the config, making this test case valid.
ensureNewTimeout(timeoutCh, height, round, cs.config.TimeoutPropose.Nanoseconds())

round++ // moving to the next round
Expand Down

0 comments on commit aabf2c6

Please sign in to comment.