core/state/snapshot: fix various iteration issues due to destruct set

This commit is contained in:
Péter Szilágyi
2020-03-04 15:06:04 +02:00
parent bc5d742c66
commit fab0ee3bfa
4 changed files with 67 additions and 39 deletions

View File

@ -493,12 +493,14 @@ func (dl *diffLayer) AccountList() []common.Hash {
defer dl.lock.Unlock()
dl.accountList = make([]common.Hash, 0, len(dl.destructSet)+len(dl.accountData))
for hash := range dl.destructSet {
dl.accountList = append(dl.accountList, hash)
}
for hash := range dl.accountData {
dl.accountList = append(dl.accountList, hash)
}
for hash := range dl.destructSet {
if _, ok := dl.accountData[hash]; !ok {
dl.accountList = append(dl.accountList, hash)
}
}
sort.Sort(hashes(dl.accountList))
return dl.accountList
}