From 4d92fd7aef8531bd74e5fec96dedd7d923f91cbe Mon Sep 17 00:00:00 2001 From: qinglin89 <316032931@qq.com> Date: Wed, 20 Jul 2022 10:51:37 +0800 Subject: [PATCH] some missed s.prefetcher value copy --- core/state/state_object.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index a526d3ab24..df6c03e769 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -169,10 +169,11 @@ func (s *StateObject) getTrie(db Database) Trie { if s.trie == nil { // Try fetching from prefetcher first // We don't prefetch empty tries - if s.data.Root != emptyRoot && s.db.prefetcher != nil { + 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 = s.db.prefetcher.trie(s.data.Root) + s.trie = prefetcher.trie(s.data.Root) } if s.trie == nil { var err error @@ -375,8 +376,9 @@ func (s *StateObject) finalise(prefetch bool) { } } - if s.db.prefetcher != nil && prefetch && len(slotsToPrefetch) > 0 && s.data.Root != emptyRoot && s.data.Root != dummyRoot { - s.db.prefetcher.prefetch(s.data.Root, slotsToPrefetch, s.addrHash) + prefetcher := s.db.prefetcher + if prefetcher != nil && prefetch && len(slotsToPrefetch) > 0 && s.data.Root != emptyRoot && s.data.Root != dummyRoot { + prefetcher.prefetch(s.data.Root, slotsToPrefetch, s.addrHash) } if len(s.dirtyStorage) > 0 { s.dirtyStorage = make(Storage)