(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestMempoolProgressInHigherRound(t *testing.T) { |
| 65 | config := ResetConfig("consensus_mempool_txs_available_test") |
| 66 | defer os.RemoveAll(config.RootDir) |
| 67 | config.Consensus.CreateEmptyBlocks = false |
| 68 | state, privVals := randGenesisState(1, false, 10) |
| 69 | cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) |
| 70 | assertMempool(cs.txNotifier).EnableTxsAvailable() |
| 71 | height, round := cs.Height, cs.Round |
| 72 | newBlockCh := subscribe(cs.eventBus, types.EventQueryNewBlock) |
| 73 | newRoundCh := subscribe(cs.eventBus, types.EventQueryNewRound) |
| 74 | timeoutCh := subscribe(cs.eventBus, types.EventQueryTimeoutPropose) |
| 75 | cs.setProposal = func(proposal *types.Proposal) error { |
| 76 | if cs.Height == 2 && cs.Round == 0 { |
| 77 | // dont set the proposal in round 0 so we timeout and |
| 78 | // go to next round |
| 79 | cs.Logger.Info("Ignoring set proposal at height 2, round 0") |
| 80 | return nil |
| 81 | } |
| 82 | return cs.defaultSetProposal(proposal) |
| 83 | } |
| 84 | startTestRound(cs, height, round) |
| 85 | |
| 86 | ensureNewRound(newRoundCh, height, round) // first round at first height |
| 87 | ensureNewEventOnChannel(newBlockCh) // first block gets committed |
| 88 | |
| 89 | height++ // moving to the next height |
| 90 | round = 0 |
| 91 | |
| 92 | ensureNewRound(newRoundCh, height, round) // first round at next height |
| 93 | deliverTxsRange(cs, 0, 1) // we deliver txs, but dont set a proposal so we get the next round |
| 94 | ensureNewTimeout(timeoutCh, height, round, cs.config.TimeoutPropose.Nanoseconds()) |
| 95 | |
| 96 | round++ // moving to the next round |
| 97 | ensureNewRound(newRoundCh, height, round) // wait for the next round |
| 98 | ensureNewEventOnChannel(newBlockCh) // now we can commit the block |
| 99 | } |
| 100 | |
| 101 | func deliverTxsRange(cs *State, start, end int) { |
| 102 | // Deliver some txs. |
nothing calls this directly
no test coverage detected