stop state size inside stop without saving

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-08-12 15:03:10 +08:00 committed by Gary Rong
parent e1c599e286
commit 0a14a72eab

View file

@ -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 {