Merge pull request #21036 from karalabe/snapshot-storage-leak

core/state/snapshot: don't create storage list for non-existing accounts
This commit is contained in:
Péter Szilágyi 2020-05-06 18:11:15 +03:00 committed by GitHub
commit 87c463c47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -526,6 +526,11 @@ func (dl *diffLayer) StorageList(accountHash common.Hash) ([]common.Hash, bool)
// If an old list already exists, return it
dl.lock.RLock()
_, destructed := dl.destructSet[accountHash]
if _, ok := dl.storageData[accountHash]; !ok {
// Account not tracked by this layer
dl.lock.RUnlock()
return nil, destructed
}
if list, exist := dl.storageList[accountHash]; exist {
dl.lock.RUnlock()
return list, destructed // The list might be nil