mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +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)
|
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||||
p.chain.Engine().Finalize(p.chain, header, tracingStateDB, block.Body())
|
p.chain.Engine().Finalize(p.chain, header, tracingStateDB, block.Body())
|
||||||
|
|
||||||
|
if hooks := cfg.Tracer; hooks != nil && hooks.OnPreTxExecutionDone != nil {
|
||||||
|
hooks.OnPreTxExecutionDone()
|
||||||
|
}
|
||||||
|
|
||||||
return &ProcessResult{
|
return &ProcessResult{
|
||||||
Receipts: receipts,
|
Receipts: receipts,
|
||||||
Requests: requests,
|
Requests: requests,
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,13 @@ type (
|
||||||
// beacon block root.
|
// beacon block root.
|
||||||
OnSystemCallEndHook = func()
|
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 -
|
- State events -
|
||||||
*/
|
*/
|
||||||
|
|
@ -209,6 +216,10 @@ type Hooks struct {
|
||||||
OnSystemCallStart OnSystemCallStartHook
|
OnSystemCallStart OnSystemCallStartHook
|
||||||
OnSystemCallStartV2 OnSystemCallStartHookV2
|
OnSystemCallStartV2 OnSystemCallStartHookV2
|
||||||
OnSystemCallEnd OnSystemCallEndHook
|
OnSystemCallEnd OnSystemCallEndHook
|
||||||
|
|
||||||
|
OnPreTxExecutionDone OnPreTxExecutionDoneHook
|
||||||
|
OnBlockFinalization OnBlockFinalizationHook
|
||||||
|
|
||||||
// State events
|
// State events
|
||||||
OnBalanceChange BalanceChangeHook
|
OnBalanceChange BalanceChangeHook
|
||||||
OnNonceChange NonceChangeHook
|
OnNonceChange NonceChangeHook
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue