diff --git a/core/plugeth_injection_test.go b/core/plugeth_injection_test.go index 08108f242..3672be1b6 100644 --- a/core/plugeth_injection_test.go +++ b/core/plugeth_injection_test.go @@ -106,12 +106,16 @@ func TestPlugethInjections(t *testing.T) { t.Run(fmt.Sprintf("test BlockProcessingError"), func(t *testing.T) { called := false injectionCalled = &called + metaInjectionCalled = &called _, _, _, _ = sp.Process(block, statedb, vm.Config{}) if *injectionCalled != true { t.Fatalf("pluginBlockProcessingError injection in stateProcessor.Process() not called") } + if *metaInjectionCalled != true { + t.Fatalf("metaTracer.BlockProcessingError injection in stateProcessor.Process() not called") + } }) t.Run(fmt.Sprintf("test Reorg"), func(t *testing.T) { @@ -134,17 +138,6 @@ func TestPlugethInjections(t *testing.T) { } }) - t.Run(fmt.Sprintf("test treiIntervarFlushClone"), func(t *testing.T) { - called := false - injectionCalled = &called - - _ = blockchain.writeBlockWithState(block, []*types.Receipt{}, statedb) - - if *injectionCalled != true { - t.Fatalf("pluginNewSideBlock injection in blockChain.writeBlockAndSetHead() not called") - } - }) - t.Run(fmt.Sprintf("test NewSideBlock"), func(t *testing.T) { called := false injectionCalled = &called diff --git a/core/plugin_hooks.go b/core/plugin_hooks.go index 06d2e89ee..5d95af640 100644 --- a/core/plugin_hooks.go +++ b/core/plugin_hooks.go @@ -19,6 +19,7 @@ import ( ) var injectionCalled *bool +var metaInjectionCalled *bool func PluginPreProcessBlock(pl *plugins.PluginLoader, block *types.Block) { fnList := pl.Lookup("PreProcessBlock", func(item interface{}) bool { @@ -229,6 +230,12 @@ func (mt *metaTracer) PreProcessTransaction(tx *types.Transaction, block *types. } } func (mt *metaTracer) BlockProcessingError(tx *types.Transaction, block *types.Block, err error) { + + if metaInjectionCalled != nil { + called := true + metaInjectionCalled = &called + } + if len(mt.tracers) == 0 { return } blockHash := core.Hash(block.Hash()) transactionHash := core.Hash(tx.Hash())