core/state/snapshot: fix typo (#21037)

This commit is contained in:
gary rong 2020-05-07 15:07:59 +08:00 committed by GitHub
parent 87c463c47a
commit 85944c2561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -523,7 +523,6 @@ func (dl *diffLayer) AccountList() []common.Hash {
// //
// Note, the returned slice is not a copy, so do not modify it. // Note, the returned slice is not a copy, so do not modify it.
func (dl *diffLayer) StorageList(accountHash common.Hash) ([]common.Hash, bool) { func (dl *diffLayer) StorageList(accountHash common.Hash) ([]common.Hash, bool) {
// If an old list already exists, return it
dl.lock.RLock() dl.lock.RLock()
_, destructed := dl.destructSet[accountHash] _, destructed := dl.destructSet[accountHash]
if _, ok := dl.storageData[accountHash]; !ok { if _, ok := dl.storageData[accountHash]; !ok {
@ -531,9 +530,10 @@ func (dl *diffLayer) StorageList(accountHash common.Hash) ([]common.Hash, bool)
dl.lock.RUnlock() dl.lock.RUnlock()
return nil, destructed return nil, destructed
} }
// If an old list already exists, return it
if list, exist := dl.storageList[accountHash]; exist { if list, exist := dl.storageList[accountHash]; exist {
dl.lock.RUnlock() dl.lock.RUnlock()
return list, destructed // The list might be nil return list, destructed // the cached list can't be nil
} }
dl.lock.RUnlock() dl.lock.RUnlock()