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 authored and whw188 committed Dec 6, 2023
1 parent 6c96460 commit 7302c5b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ func (s *stateObject) touch() {
func (s *stateObject) getTrie() (Trie, error) {
if s.trie == nil {
// Try fetching from prefetcher first
if s.data.Root != types.EmptyRootHash && s.db.prefetcher != nil {
// When the miner is creating the pending state, there is no prefetcher
s.trie = s.db.prefetcher.trie(s.addrHash, s.data.Root)
}
if s.trie == nil {
tr, err := s.db.db.OpenStorageTrie(s.db.originalRoot, s.address, s.data.Root)
if err != nil {
return nil, err
}
s.trie = tr
// if s.data.Root != types.EmptyRootHash && s.db.prefetcher != nil {
// When the miner is creating the pending state, there is no prefetcher
// s.trie = s.db.prefetcher.trie(s.addrHash, s.data.Root)
// }
// if s.trie == nil {
tr, err := s.db.db.OpenStorageTrie(s.db.originalRoot, s.address, s.data.Root)
if err != nil {
return nil, err
}
s.trie = tr
// }
}
return s.trie, nil
}
Expand Down

0 comments on commit 7302c5b

Please sign in to comment.