From 2e450bb342f8dd3bfc126148b60acbf2106d6625 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 11 May 2021 08:56:41 +0200 Subject: [PATCH] core: fix check at wrong place --- core/blockchain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index a67889b47ea1f..cd991afc53853 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1425,9 +1425,6 @@ func (bc *BlockChain) writeBlockWithoutState(block *types.Block, td *big.Int) (e // writeKnownBlock updates the head block flag with a known block // and introduces chain reorg if necessary. func (bc *BlockChain) writeKnownBlock(block *types.Block) error { - if bc.insertStopped() { - return errInsertionInterrupted - } bc.wg.Add(1) defer bc.wg.Done() @@ -1452,6 +1449,9 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. // writeBlockWithState writes the block and all associated state to the database, // but is expects the chain mutex to be held. func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) { + if bc.insertStopped() { + return NonStatTy, errInsertionInterrupted + } bc.wg.Add(1) defer bc.wg.Done()