From 68d4fed23665e95ebf5908f7676ad29be86fc0c3 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Wed, 19 Jan 2022 10:47:06 -0800 Subject: [PATCH] consensus/state: avert a data race with state update and tests (#7643) --- internal/consensus/common_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 1e1a20198..3a6541f9f 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -285,6 +285,9 @@ func validatePrevote( ) { t.Helper() + cs.mtx.RLock() + defer cs.mtx.RUnlock() + prevotes := cs.Votes.Prevotes(round) pubKey, err := privVal.GetPubKey(ctx) require.NoError(t, err)