core/state/snapshot: fix race condition (#24685)

Fixes three race conditions found through fuzzing by David Theodore
This commit is contained in:
Marius van der Wijden
2022-05-06 17:20:41 +02:00
committed by GitHub
parent 345b1fb827
commit 86d5477079
2 changed files with 26 additions and 14 deletions
+3
View File
@@ -258,6 +258,9 @@ func (dl *diffLayer) Root() common.Hash {
// Parent returns the subsequent layer of a diff layer.
func (dl *diffLayer) Parent() snapshot {
dl.lock.RLock()
defer dl.lock.RUnlock()
return dl.parent
}