diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index e0781f153..bca9da1b5 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -300,6 +300,7 @@ func (bc *Blockchain) Run() { persistTimer := time.NewTimer(persistInterval) defer func() { persistTimer.Stop() + bc.addLock.Lock() // Prevent changing state, but do not release the lock, we're about to exit. if err := bc.persist(); err != nil { bc.log.Warn("failed to persist", zap.Error(err)) }