MCPcopy Create free account
hub / github.com/CPChain/chain / Stop

Method Stop

core/blockchain.go:781–796  ·  view source on GitHub ↗

Stop stops the blockchain service. If any imports are currently in progress it will abort them using the procInterrupt.

()

Source from the content-addressed store, hash-verified

779// Stop stops the blockchain service. If any imports are currently in progress
780// it will abort them using the procInterrupt.
781func (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
798func (bc *BlockChain) CommitStateDB() {
799 // Ensure the state of a recent block is also stored to disk.

Callers 11

GenerateChainFunction · 0.95
TestHeaderVerificationFunction · 0.95
ExampleGenerateChainFunction · 0.95
benchInsertChainFunction · 0.95
benchReadChainFunction · 0.95
TestChainTxReorgsFunction · 0.95
TestLogReorgsFunction · 0.95
TestReorgSideEventFunction · 0.95
RunMethod · 0.95

Calls 4

CommitStateDBMethod · 0.95
WaitMethod · 0.80
CloseMethod · 0.65
InfoMethod · 0.65

Tested by 9

TestHeaderVerificationFunction · 0.76
ExampleGenerateChainFunction · 0.76
benchInsertChainFunction · 0.76
benchReadChainFunction · 0.76
TestChainTxReorgsFunction · 0.76
TestLogReorgsFunction · 0.76
TestReorgSideEventFunction · 0.76