Skip to content

Commit

Permalink
core/state: fix prefetcher for verkle (ethereum#29760)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored Jul 11, 2024
1 parent bcaf374 commit cf03784
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,12 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
// Now we're about to start to write changes to the trie. The trie is so far
// _untouched_. We can check with the prefetcher, if it can give us a trie
// which has the same root, but also has some content loaded into it.
//
// Don't check prefetcher if verkle trie has been used. In the context of verkle,
// only a single trie is used for state hashing. Replacing a non-nil verkle tree
// here could result in losing uncommitted changes from storage.
start = time.Now()

if s.prefetcher != nil {
if s.prefetcher != nil && (s.trie == nil || !s.trie.IsVerkle()) {
if trie := s.prefetcher.trie(common.Hash{}, s.originalRoot); trie == nil {
log.Error("Failed to retrieve account pre-fetcher trie")
} else {
Expand Down

0 comments on commit cf03784

Please sign in to comment.