Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 committed Nov 27, 2024
1 parent 776bfb7 commit 966fcaa
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,31 +1025,30 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
usedAddrs [][]byte
deletedAddrs []common.Address
)
if !s.noTrie {
for addr, op := range s.mutations {
if op.applied {
continue
}
op.applied = true

if op.isDelete() {
deletedAddrs = append(deletedAddrs, addr)
} else {
s.updateStateObject(s.stateObjects[addr])
s.AccountUpdated += 1
}
usedAddrs = append(usedAddrs, common.CopyBytes(addr[:])) // Copy needed for closure
}
for _, deletedAddr := range deletedAddrs {
s.deleteStateObject(deletedAddr)
s.AccountDeleted += 1
for addr, op := range s.mutations {
if op.applied {
continue
}
s.AccountUpdates += time.Since(start)
op.applied = true

if s.prefetcher != nil {
s.prefetcher.used(common.Hash{}, s.originalRoot, usedAddrs)
if op.isDelete() {
deletedAddrs = append(deletedAddrs, addr)
} else {
s.updateStateObject(s.stateObjects[addr])
s.AccountUpdated += 1
}
usedAddrs = append(usedAddrs, common.CopyBytes(addr[:])) // Copy needed for closure
}
for _, deletedAddr := range deletedAddrs {
s.deleteStateObject(deletedAddr)
s.AccountDeleted += 1
}
s.AccountUpdates += time.Since(start)

if s.prefetcher != nil && len(usedAddrs) > 0 {
s.prefetcher.used(common.Hash{}, s.originalRoot, usedAddrs)
}

// Track the amount of time wasted on hashing the account trie
defer func(start time.Time) { s.AccountHashes += time.Since(start) }(time.Now())

Expand Down

0 comments on commit 966fcaa

Please sign in to comment.