From 851e9e35f1fa4e4d98c2b82229d39084ce715c4f Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Wed, 6 Apr 2022 10:31:11 +0800 Subject: [PATCH] put error check to the correct location --- core/state_processor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/state_processor.go b/core/state_processor.go index 26f5f84fb9..8e9422a8e8 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -123,13 +123,13 @@ func (p *LightStateProcessor) Process(block *types.Block, statedb *state.StateDB statedb.StopPrefetcher() parent := p.bc.GetHeader(block.ParentHash(), block.NumberU64()-1) statedb, err = state.New(parent.Root, p.bc.stateCache, p.bc.snaps) + if err != nil { + return statedb, nil, nil, 0, err + } statedb.SetExpectedStateRoot(block.Root()) if p.bc.pipeCommit { statedb.EnablePipeCommit() } - if err != nil { - return statedb, nil, nil, 0, err - } // Enable prefetching to pull in trie node paths while processing transactions statedb.StartPrefetcher("chain") }