mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
add pre-transaction/post-block-finalization hooks
This commit is contained in:
parent
79b6a56d3a
commit
cba057f8cb
2 changed files with 15 additions and 0 deletions
|
|
@ -129,6 +129,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
|||
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||
p.chain.Engine().Finalize(p.chain, header, tracingStateDB, block.Body())
|
||||
|
||||
if hooks := cfg.Tracer; hooks != nil && hooks.OnPreTxExecutionDone != nil {
|
||||
hooks.OnPreTxExecutionDone()
|
||||
}
|
||||
|
||||
return &ProcessResult{
|
||||
Receipts: receipts,
|
||||
Requests: requests,
|
||||
|
|
|
|||
|
|
@ -161,6 +161,13 @@ type (
|
|||
// beacon block root.
|
||||
OnSystemCallEndHook = func()
|
||||
|
||||
// OnPreTxExecutionDoneHook is called immediately prior to executing the first
|
||||
// transaction in the block.
|
||||
OnPreTxExecutionDoneHook func()
|
||||
|
||||
// OnBlockFinalizationHook is called immediately after block rewards are applied
|
||||
OnBlockFinalizationHook func()
|
||||
|
||||
/*
|
||||
- State events -
|
||||
*/
|
||||
|
|
@ -209,6 +216,10 @@ type Hooks struct {
|
|||
OnSystemCallStart OnSystemCallStartHook
|
||||
OnSystemCallStartV2 OnSystemCallStartHookV2
|
||||
OnSystemCallEnd OnSystemCallEndHook
|
||||
|
||||
OnPreTxExecutionDone OnPreTxExecutionDoneHook
|
||||
OnBlockFinalization OnBlockFinalizationHook
|
||||
|
||||
// State events
|
||||
OnBalanceChange BalanceChangeHook
|
||||
OnNonceChange NonceChangeHook
|
||||
|
|
|
|||
Loading…
Reference in a new issue