diff --git a/core/blockchain.go b/core/blockchain.go index 790ec1f152..963e7bcec5 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1259,6 +1259,12 @@ func (bc *BlockChain) stopWithoutSaving() { // Signal shutdown to all goroutines. bc.InterruptInsert(true) + // Stop state size generator if running + if bc.stateSizeGen != nil { + bc.stateSizeGen.Stop() + log.Info("Stopped state size generator") + } + // Now wait for all chain modifications to end and persistent goroutines to exit. // // Note: Close waits for the mutex to become available, i.e. any running chain @@ -1320,11 +1326,6 @@ func (bc *BlockChain) Stop() { } } } - // Stop state size generator if running - if bc.stateSizeGen != nil { - bc.stateSizeGen.Stop() - log.Info("Stopped state size generator") - } // Allow tracers to clean-up and release resources. if bc.logger != nil && bc.logger.OnClose != nil {