From 568fdd60e6deaf731c4ec6092724424f03c211a5 Mon Sep 17 00:00:00 2001 From: setunapo Date: Tue, 28 Jun 2022 10:29:09 +0800 Subject: [PATCH] fix review comments --- core/state/statedb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 2182a2f648..dad82c30c4 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -223,6 +223,9 @@ func (s *StateDB) StopPrefetcher() { } func (s *StateDB) TriePrefetchInAdvance(block *types.Block, signer types.Signer) { + if s.prefetcher == nil { + return + } accounts := make(map[common.Address]struct{}, block.Transactions().Len()<<1) for _, tx := range block.Transactions() { from, err := types.Sender(signer, tx) @@ -240,7 +243,7 @@ func (s *StateDB) TriePrefetchInAdvance(block *types.Block, signer types.Signer) addressesToPrefetch = append(addressesToPrefetch, common.CopyBytes(addr[:])) // Copy needed for closure } - if s.prefetcher != nil && len(addressesToPrefetch) > 0 { + if len(addressesToPrefetch) > 0 { s.prefetcher.prefetch(s.originalRoot, addressesToPrefetch, emptyAddr) } }