mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
rename Hook “OnTerminate” to “OnBlockchainTerminate”
This commit is contained in:
parent
e67c3bfd62
commit
5ba5254cfb
3 changed files with 20 additions and 20 deletions
|
|
@ -1172,8 +1172,8 @@ func (bc *BlockChain) Stop() {
|
|||
log.Error("Failed to close trie database", "err", err)
|
||||
}
|
||||
// Allow tracers to clean-up and release resources.
|
||||
if bc.vmConfig.Tracer != nil && bc.vmConfig.Tracer.OnTerminate != nil {
|
||||
bc.vmConfig.Tracer.OnTerminate()
|
||||
if bc.vmConfig.Tracer != nil && bc.vmConfig.Tracer.OnBlockchainTerminate != nil {
|
||||
bc.vmConfig.Tracer.OnBlockchainTerminate()
|
||||
}
|
||||
log.Info("Blockchain stopped")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ type (
|
|||
// BlockchainInitHook is called when the blockchain is initialized.
|
||||
BlockchainInitHook = func(chainConfig *params.ChainConfig)
|
||||
|
||||
// BlockchainTerminateHook is called when the tracer is terminated.
|
||||
BlockchainTerminateHook = func()
|
||||
|
||||
// BlockStartHook is called before executing `block`.
|
||||
// `td` is the total difficulty prior to `block`.
|
||||
BlockStartHook = func(event BlockEvent)
|
||||
|
|
@ -140,9 +143,6 @@ type (
|
|||
|
||||
// LogHook is called when a log is emitted.
|
||||
LogHook = func(log *types.Log)
|
||||
|
||||
// TerminateHook is called when the tracer is terminated.
|
||||
TerminateHook = func()
|
||||
)
|
||||
|
||||
type Hooks struct {
|
||||
|
|
@ -155,18 +155,18 @@ type Hooks struct {
|
|||
OnFault FaultHook
|
||||
OnGasChange GasChangeHook
|
||||
// Chain events
|
||||
OnBlockchainInit BlockchainInitHook
|
||||
OnBlockStart BlockStartHook
|
||||
OnBlockEnd BlockEndHook
|
||||
OnSkippedBlock SkippedBlockHook
|
||||
OnGenesisBlock GenesisBlockHook
|
||||
OnBlockchainInit BlockchainInitHook
|
||||
OnBlockchainTerminate BlockchainTerminateHook
|
||||
OnBlockStart BlockStartHook
|
||||
OnBlockEnd BlockEndHook
|
||||
OnSkippedBlock SkippedBlockHook
|
||||
OnGenesisBlock GenesisBlockHook
|
||||
// State events
|
||||
OnBalanceChange BalanceChangeHook
|
||||
OnNonceChange NonceChangeHook
|
||||
OnCodeChange CodeChangeHook
|
||||
OnStorageChange StorageChangeHook
|
||||
OnLog LogHook
|
||||
OnTerminate TerminateHook
|
||||
}
|
||||
|
||||
// BalanceChangeReason is used to indicate the reason for a balance change, useful
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ func newSupply(cfg json.RawMessage) (*tracing.Hooks, error) {
|
|||
logger: logger,
|
||||
}
|
||||
return &tracing.Hooks{
|
||||
OnBlockStart: t.OnBlockStart,
|
||||
OnBlockEnd: t.OnBlockEnd,
|
||||
OnGenesisBlock: t.OnGenesisBlock,
|
||||
OnTxStart: t.OnTxStart,
|
||||
OnBalanceChange: t.OnBalanceChange,
|
||||
OnEnter: t.OnEnter,
|
||||
OnExit: t.OnExit,
|
||||
OnTerminate: t.OnTerminate,
|
||||
OnBlockStart: t.OnBlockStart,
|
||||
OnBlockEnd: t.OnBlockEnd,
|
||||
OnGenesisBlock: t.OnGenesisBlock,
|
||||
OnTxStart: t.OnTxStart,
|
||||
OnBalanceChange: t.OnBalanceChange,
|
||||
OnEnter: t.OnEnter,
|
||||
OnExit: t.OnExit,
|
||||
OnBlockchainTerminate: t.OnBlockchainTerminate,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ func (s *supply) OnExit(depth int, output []byte, gasUsed uint64, err error, rev
|
|||
s.txCallstack[size-1].calls = append(s.txCallstack[size-1].calls, call)
|
||||
}
|
||||
|
||||
func (s *supply) OnTerminate() {
|
||||
func (s *supply) OnBlockchainTerminate() {
|
||||
if err := s.logger.Close(); err != nil {
|
||||
log.Warn("failed to close supply tracer log file", "error", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue