diff --git a/core/state/trie_prefetcher.go b/core/state/trie_prefetcher.go index d24f18781c..8253fb5153 100644 --- a/core/state/trie_prefetcher.go +++ b/core/state/trie_prefetcher.go @@ -292,10 +292,6 @@ func (sf *subfetcher) loop() { tasks := sf.tasks sf.tasks = nil sf.lock.Unlock() - if tasks == nil && !keepRunning { - // No more tasks - return - } // Prefetch all tasks for _, task := range tasks { if _, ok := sf.seen[string(task)]; ok { @@ -309,5 +305,9 @@ func (sf *subfetcher) loop() { } sf.seen[string(task)] = struct{}{} } + + if !keepRunning { + return + } } }