trie: keep trie prefetch during validation phase (#1954)

This commit is contained in:
lx 2023-10-31 11:32:31 +08:00 committed by GitHub
parent 0d9151eb8f
commit 56424d390f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -149,17 +149,17 @@ func (s *stateObject) touch() {
func (s *stateObject) getTrie() (Trie, error) { func (s *stateObject) getTrie() (Trie, error) {
if s.trie == nil { if s.trie == nil {
// Try fetching from prefetcher first // Try fetching from prefetcher first
if s.data.Root != types.EmptyRootHash && s.db.prefetcher != nil { // if s.data.Root != types.EmptyRootHash && s.db.prefetcher != nil {
// When the miner is creating the pending state, there is no prefetcher // When the miner is creating the pending state, there is no prefetcher
s.trie = s.db.prefetcher.trie(s.addrHash, s.data.Root) // s.trie = s.db.prefetcher.trie(s.addrHash, s.data.Root)
} // }
if s.trie == nil { // if s.trie == nil {
tr, err := s.db.db.OpenStorageTrie(s.db.originalRoot, s.address, s.data.Root) tr, err := s.db.db.OpenStorageTrie(s.db.originalRoot, s.address, s.data.Root)
if err != nil { if err != nil {
return nil, err return nil, err
}
s.trie = tr
} }
s.trie = tr
// }
} }
return s.trie, nil return s.trie, nil
} }