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)
|
log.Error("Failed to close trie database", "err", err)
|
||||||
}
|
}
|
||||||
// Allow tracers to clean-up and release resources.
|
// Allow tracers to clean-up and release resources.
|
||||||
if bc.vmConfig.Tracer != nil && bc.vmConfig.Tracer.OnTerminate != nil {
|
if bc.vmConfig.Tracer != nil && bc.vmConfig.Tracer.OnBlockchainTerminate != nil {
|
||||||
bc.vmConfig.Tracer.OnTerminate()
|
bc.vmConfig.Tracer.OnBlockchainTerminate()
|
||||||
}
|
}
|
||||||
log.Info("Blockchain stopped")
|
log.Info("Blockchain stopped")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,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)
|
||||||
|
|
||||||
|
// BlockchainTerminateHook is called when the tracer is terminated.
|
||||||
|
BlockchainTerminateHook = 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)
|
||||||
|
|
@ -140,9 +143,6 @@ type (
|
||||||
|
|
||||||
// LogHook is called when a log is emitted.
|
// LogHook is called when a log is emitted.
|
||||||
LogHook = func(log *types.Log)
|
LogHook = func(log *types.Log)
|
||||||
|
|
||||||
// TerminateHook is called when the tracer is terminated.
|
|
||||||
TerminateHook = func()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Hooks struct {
|
type Hooks struct {
|
||||||
|
|
@ -155,18 +155,18 @@ type Hooks struct {
|
||||||
OnFault FaultHook
|
OnFault FaultHook
|
||||||
OnGasChange GasChangeHook
|
OnGasChange GasChangeHook
|
||||||
// Chain events
|
// Chain events
|
||||||
OnBlockchainInit BlockchainInitHook
|
OnBlockchainInit BlockchainInitHook
|
||||||
OnBlockStart BlockStartHook
|
OnBlockchainTerminate BlockchainTerminateHook
|
||||||
OnBlockEnd BlockEndHook
|
OnBlockStart BlockStartHook
|
||||||
OnSkippedBlock SkippedBlockHook
|
OnBlockEnd BlockEndHook
|
||||||
OnGenesisBlock GenesisBlockHook
|
OnSkippedBlock SkippedBlockHook
|
||||||
|
OnGenesisBlock GenesisBlockHook
|
||||||
// State events
|
// State events
|
||||||
OnBalanceChange BalanceChangeHook
|
OnBalanceChange BalanceChangeHook
|
||||||
OnNonceChange NonceChangeHook
|
OnNonceChange NonceChangeHook
|
||||||
OnCodeChange CodeChangeHook
|
OnCodeChange CodeChangeHook
|
||||||
OnStorageChange StorageChangeHook
|
OnStorageChange StorageChangeHook
|
||||||
OnLog LogHook
|
OnLog LogHook
|
||||||
OnTerminate TerminateHook
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceChangeReason is used to indicate the reason for a balance change, useful
|
// 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,
|
logger: logger,
|
||||||
}
|
}
|
||||||
return &tracing.Hooks{
|
return &tracing.Hooks{
|
||||||
OnBlockStart: t.OnBlockStart,
|
OnBlockStart: t.OnBlockStart,
|
||||||
OnBlockEnd: t.OnBlockEnd,
|
OnBlockEnd: t.OnBlockEnd,
|
||||||
OnGenesisBlock: t.OnGenesisBlock,
|
OnGenesisBlock: t.OnGenesisBlock,
|
||||||
OnTxStart: t.OnTxStart,
|
OnTxStart: t.OnTxStart,
|
||||||
OnBalanceChange: t.OnBalanceChange,
|
OnBalanceChange: t.OnBalanceChange,
|
||||||
OnEnter: t.OnEnter,
|
OnEnter: t.OnEnter,
|
||||||
OnExit: t.OnExit,
|
OnExit: t.OnExit,
|
||||||
OnTerminate: t.OnTerminate,
|
OnBlockchainTerminate: t.OnBlockchainTerminate,
|
||||||
}, nil
|
}, 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)
|
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 {
|
if err := s.logger.Close(); err != nil {
|
||||||
log.Warn("failed to close supply tracer log file", "error", err)
|
log.Warn("failed to close supply tracer log file", "error", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue