core/state: fix an account resurrection issue

This commit is contained in:
Péter Szilágyi
2020-02-27 15:03:10 +02:00
parent 06d4470b41
commit 92ec07d63b
2 changed files with 5 additions and 12 deletions

View File

@ -297,18 +297,11 @@ func (s *stateObject) updateTrie(db Database) Trie {
// Retrieve the snapshot storage map for the object
var storage map[common.Hash][]byte
if s.db.snap != nil {
// Retrieve the old storage map, if available
s.db.snapLock.RLock()
// Retrieve the old storage map, if available, create a new one otherwise
storage = s.db.snapStorage[s.addrHash]
s.db.snapLock.RUnlock()
// If no old storage map was available, create a new one
if storage == nil {
storage = make(map[common.Hash][]byte)
s.db.snapLock.Lock()
s.db.snapStorage[s.addrHash] = storage
s.db.snapLock.Unlock()
}
}
// Insert all the pending updates into the trie