From f9941c4d09e7a1d8889c1c1cd6b801494d7e41fa Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 24 Sep 2021 10:40:55 -0400 Subject: [PATCH] update validatePrevotes to correctly look for nil --- internal/consensus/state_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index 899994c42..3becdf998 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -1022,7 +1022,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) { theBlockParts := rs.ProposalBlockParts.Header() ensurePrevote(t, voteCh, height, round) - validatePrevote(t, cs1, round, vss[0], nil) + validatePrevote(t, cs1, round, vss[0], theBlockHash) signAddVotes(config, cs1, tmproto.PrevoteType, theBlockHash, theBlockParts, vs2, vs3, vs4) @@ -1668,8 +1668,9 @@ func TestProposeValidBlock(t *testing.T) { // timeout of propose ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) + // We did not see a valid proposal within this round, so prevote nil. ensurePrevote(t, voteCh, height, round) - validatePrevote(t, cs1, round, vss[0], propBlockHash) + validatePrevote(t, cs1, round, vss[0], nil) signAddVotes(config, cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4) @@ -2305,13 +2306,13 @@ func TestStateHalt1(t *testing.T) { t.Log("### ONTO ROUND 1") /*Round2 - // we timeout and prevote our lock + // we timeout and prevote // a polka happened but we didn't see it! */ - // go to prevote, prevote for locked block + // prevote for nil since we did not receive a proposal in this round. ensurePrevote(t, voteCh, height, round) - validatePrevote(t, cs1, round, vss[0], rs.LockedBlock.Hash()) + validatePrevote(t, cs1, round, vss[0], nil) // now we receive the precommit from the previous round addVotes(cs1, precommit4)