Skip to content

Commit

Permalink
trie: keep trie prefetch during validation phase (bnb-chain#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
brilliant-lx committed Oct 31, 2023
1 parent bb6bdc0 commit 5c3540d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ func (s *StateObject) getTrie(db Database) Trie {
if s.trie == nil {
// Try fetching from prefetcher first
// We don't prefetch empty tries
prefetcher := s.db.prefetcher
if s.data.Root != emptyRoot && prefetcher != nil {
// When the miner is creating the pending state, there is no
// prefetcher
s.trie = prefetcher.trie(s.data.Root)
}
if s.trie == nil {
var err error
s.trie, err = db.OpenStorageTrie(s.addrHash, s.data.Root)
if err != nil {
s.trie, _ = db.OpenStorageTrie(s.addrHash, common.Hash{})
s.setError(fmt.Errorf("can't create storage trie: %v", err))
}
// prefetcher := s.db.prefetcher
// if s.data.Root != emptyRoot && prefetcher != nil {
// When the miner is creating the pending state, there is no
// prefetcher
// s.trie = prefetcher.trie(s.data.Root)
// }
// if s.trie == nil {
var err error
s.trie, err = db.OpenStorageTrie(s.addrHash, s.data.Root)
if err != nil {
s.trie, _ = db.OpenStorageTrie(s.addrHash, common.Hash{})
s.setError(fmt.Errorf("can't create storage trie: %v", err))
}
// }
}
return s.trie
}
Expand Down

0 comments on commit 5c3540d

Please sign in to comment.