Skip to content

Commit

Permalink
core: don't write blocks after insertion is stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Aug 27, 2021
1 parent 62ad17f commit a854da8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,9 @@ var lastWrite uint64
// but does not write any state. This is used to construct competing side forks
// up to the point where they exceed the canonical total difficulty.
func (bc *BlockChain) writeBlockWithoutState(block *types.Block, td *big.Int) (err error) {
if bc.insertStopped() {
return errInsertionInterrupted
}
bc.wg.Add(1)
defer bc.wg.Done()

Expand All @@ -1422,6 +1425,9 @@ 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()

Expand Down

0 comments on commit a854da8

Please sign in to comment.