mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
parent
5ef325b759
commit
fd040ec0d7
2 changed files with 8 additions and 0 deletions
|
|
@ -1161,6 +1161,10 @@ func (bc *BlockChain) Stop() {
|
||||||
bc.chainmu.Close()
|
bc.chainmu.Close()
|
||||||
bc.wg.Wait()
|
bc.wg.Wait()
|
||||||
bc.saveData()
|
bc.saveData()
|
||||||
|
// Allow tracers to clean-up and release resources.
|
||||||
|
if bc.logger != nil && bc.logger.OnClose != nil {
|
||||||
|
bc.logger.OnClose()
|
||||||
|
}
|
||||||
// Flush the collected preimages to disk
|
// Flush the collected preimages to disk
|
||||||
if err := bc.stateCache.TrieDB().CommitPreimages(); err != nil {
|
if err := bc.stateCache.TrieDB().CommitPreimages(); err != nil {
|
||||||
log.Error("Failed to commit trie preimages", "err", err)
|
log.Error("Failed to commit trie preimages", "err", err)
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,9 @@ type (
|
||||||
// BlockchainInitHook is called when the blockchain is initialized.
|
// BlockchainInitHook is called when the blockchain is initialized.
|
||||||
BlockchainInitHook = func(chainConfig *params.ChainConfig)
|
BlockchainInitHook = func(chainConfig *params.ChainConfig)
|
||||||
|
|
||||||
|
// CloseHook is called when the blockchain closes.
|
||||||
|
CloseHook = func()
|
||||||
|
|
||||||
// BlockStartHook is called before executing `block`.
|
// BlockStartHook is called before executing `block`.
|
||||||
// `td` is the total difficulty prior to `block`.
|
// `td` is the total difficulty prior to `block`.
|
||||||
BlockStartHook = func(event BlockEvent)
|
BlockStartHook = func(event BlockEvent)
|
||||||
|
|
@ -177,6 +180,7 @@ type Hooks struct {
|
||||||
OnGasChange GasChangeHook
|
OnGasChange GasChangeHook
|
||||||
// Chain events
|
// Chain events
|
||||||
OnBlockchainInit BlockchainInitHook
|
OnBlockchainInit BlockchainInitHook
|
||||||
|
OnClose CloseHook
|
||||||
OnBlockStart BlockStartHook
|
OnBlockStart BlockStartHook
|
||||||
OnBlockEnd BlockEndHook
|
OnBlockEnd BlockEndHook
|
||||||
OnSkippedBlock SkippedBlockHook
|
OnSkippedBlock SkippedBlockHook
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue