Skip to content

Commit

Permalink
core: use StopPrefetcher insteadof anony func
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglin89 committed Aug 26, 2022
1 parent 9140376 commit fa4086e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa4086e

Please sign in to comment.