ensureProposal returns proposed blockID

This commit is contained in:
William Banfield
2022-01-21 13:08:44 -05:00
parent fb0b6bc774
commit 247e4afcc2
2 changed files with 6 additions and 6 deletions

View File

@@ -587,7 +587,7 @@ func ensureNewTimeout(t *testing.T, timeoutCh <-chan tmpubsub.Message, height in
"Timeout expired while waiting for NewTimeout event")
}
func ensureNewProposal(t *testing.T, proposalCh <-chan tmpubsub.Message, height int64, round int32) {
func ensureNewProposal(t *testing.T, proposalCh <-chan tmpubsub.Message, height int64, round int32) types.BlockID {
t.Helper()
select {
case <-time.After(ensureTimeout):
@@ -599,7 +599,9 @@ func ensureNewProposal(t *testing.T, proposalCh <-chan tmpubsub.Message, height
require.Equal(t, height, proposalEvent.Height)
require.Equal(t, round, proposalEvent.Round)
return proposalEvent.BlockID
}
return types.BlockID{}
}
func ensureNewValidBlock(t *testing.T, validBlockCh <-chan tmpubsub.Message, height int64, round int32) {

View File

@@ -367,18 +367,16 @@ func TestStateFullRound1(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round)
ensureNewProposal(t, propCh, height, round)
propBlockHash := cs.GetRoundState().ProposalBlock.Hash()
require.NotNil(t, propBlockHash)
propBlock := ensureNewProposal(t, propCh, height, round)
ensurePrevoteMatch(t, voteCh, height, round, propBlockHash) // wait for prevote
ensurePrevoteMatch(t, voteCh, height, round, propBlock.Hash) // wait for prevote
ensurePrecommit(t, voteCh, height, round) // wait for precommit
// we're going to roll right into new height
ensureNewRound(t, newRoundCh, height+1, 0)
validateLastPrecommit(ctx, t, cs, vss[0], propBlockHash)
validateLastPrecommit(ctx, t, cs, vss[0], propBlock.Hash)
}
// nil is proposed, so prevote and precommit nil