Stop stops the blockchain service. If any imports are currently in progress it will abort them using the procInterrupt.
()
| 779 | // Stop stops the blockchain service. If any imports are currently in progress |
| 780 | // it will abort them using the procInterrupt. |
| 781 | func (bc *BlockChain) Stop() { |
| 782 | if !atomic.CompareAndSwapInt32(&bc.running, 0, 1) { |
| 783 | return |
| 784 | } |
| 785 | |
| 786 | bc.CommitStateDB() |
| 787 | |
| 788 | // Unsubscribe all subscriptions registered from blockchain |
| 789 | bc.scope.Close() |
| 790 | close(bc.Quit) |
| 791 | atomic.StoreInt32(&bc.procInterrupt, 1) |
| 792 | |
| 793 | bc.wg.Wait() |
| 794 | |
| 795 | log.Info("Blockchain manager stopped") |
| 796 | } |
| 797 | |
| 798 | func (bc *BlockChain) CommitStateDB() { |
| 799 | // Ensure the state of a recent block is also stored to disk. |