From fa4086ea1a473033b936af1f5b45ec9532d70745 Mon Sep 17 00:00:00 2001 From: qinglin89 <316032931@qq.com> Date: Thu, 25 Aug 2022 15:55:38 +0800 Subject: [PATCH] core: use StopPrefetcher insteadof anony func --- core/state/statedb.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 8f8a59d599..e7bf3c9491 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1154,15 +1154,7 @@ func (s *StateDB) StateIntermediateRoot() common.Hash { // the remainder without, but pre-byzantium even the initial prefetcher is // useless, so no sleep lost. prefetcher := s.prefetcher - defer func() { - s.prefetcherLock.Lock() - if s.prefetcher != nil { - s.prefetcher.close() - s.prefetcher = nil - } - // try not use defer inside defer - s.prefetcherLock.Unlock() - }() + defer s.StopPrefetcher() // 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