added meta blockProcessingError to test
This commit is contained in:
parent
b19d7f9f9e
commit
8a33d8e506
@ -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
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user