evidence: fix data race in Pool.updateValToLastHeight() (#5100)

Fixes #5098.

Is this out in a public release? If so, I'll add a changelog entry as well, for backporting.
This commit is contained in:
Erik Grinaker
2020-07-08 13:19:18 +00:00
committed by GitHub
parent fca788a4e1
commit 58113e31ae
+3
View File
@@ -712,6 +712,9 @@ func evMapKey(ev types.Evidence) string {
}
func (evpool *Pool) updateValToLastHeight(blockHeight int64, state sm.State) {
evpool.mtx.Lock()
defer evpool.mtx.Unlock()
// Update current validators & add new ones.
for _, val := range state.Validators.Validators {
evpool.valToLastHeight[string(val.Address)] = blockHeight