commit empty blocks when needed to prove app hash

This commit is contained in:
Ethan Buchman
2017-07-20 14:43:16 -04:00
parent fc3fe9292f
commit ecdda69fab
2 changed files with 23 additions and 6 deletions

View File

@ -15,7 +15,7 @@ func init() {
config = ResetConfig("consensus_mempool_test")
}
func TestTxsAvailable(t *testing.T) {
func TestNoProgressUntilTxsAvailable(t *testing.T) {
config := ResetConfig("consensus_mempool_txs_available_test")
config.Consensus.NoEmptyBlocks = true
state, privVals := randGenesisState(1, false, 10)
@ -25,10 +25,12 @@ func TestTxsAvailable(t *testing.T) {
newBlockCh := subscribeToEvent(cs.evsw, "tester", types.EventStringNewBlock(), 1)
startTestRound(cs, height, round)
// we shouldnt make progress until theres a tx
ensureNewStep(newBlockCh) // first block gets committed
ensureNoNewStep(newBlockCh)
deliverTxsRange(cs, 0, 2)
ensureNewStep(newBlockCh) // commit txs
ensureNewStep(newBlockCh) // commit updated app hash
ensureNoNewStep(newBlockCh)
deliverTxsRange(cs, 0, 100)
ensureNewStep(newBlockCh)
}
func deliverTxsRange(cs *ConsensusState, start, end int) {