Read lock consensus state mutex in test helper to avoid data race

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-04-11 21:08:30 -04:00
parent 550216249c
commit 8bb7983c4c

View File

@@ -350,6 +350,8 @@ func validatePrecommit(
require.True(t, bytes.Equal(vote.BlockID.Hash, votedBlockHash), "Expected precommit to be for proposal block")
}
cs.mtx.RLock()
defer cs.mtx.RUnlock()
if lockedBlockHash == nil {
require.False(t, cs.LockedRound != lockRound || cs.LockedBlock != nil,
"Expected to be locked on nil at round %d. Got locked at round %d with block %v",