Unverified Commit 85944c25 authored by gary rong's avatar gary rong Committed by GitHub

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

parent 87c463c4
...@@ -523,7 +523,6 @@ func (dl *diffLayer) AccountList() []common.Hash { ...@@ -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) ...@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment