From 58113e31aefd6275047549705d245605747a9287 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Wed, 8 Jul 2020 15:19:18 +0200 Subject: [PATCH] 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. --- evidence/pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/evidence/pool.go b/evidence/pool.go index d425ab183..4b8a10103 100644 --- a/evidence/pool.go +++ b/evidence/pool.go @@ -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