forked from cerc-io/plugeth
trieFlushClone test experiment
This commit is contained in:
parent
12336c753f
commit
23c0ca58af
@ -1334,6 +1334,7 @@ func (bc *BlockChain) writeKnownBlock(block *types.Block) error {
|
|||||||
// writeBlockWithState writes block, metadata and corresponding state data to the
|
// writeBlockWithState writes block, metadata and corresponding state data to the
|
||||||
// database.
|
// database.
|
||||||
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
||||||
|
log.Error("inside of the target function")
|
||||||
// Calculate the total difficulty of the block
|
// Calculate the total difficulty of the block
|
||||||
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
||||||
if ptd == nil {
|
if ptd == nil {
|
||||||
|
@ -134,6 +134,17 @@ 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) {
|
t.Run(fmt.Sprintf("test NewSideBlock"), func(t *testing.T) {
|
||||||
called := false
|
called := false
|
||||||
injectionCalled = &called
|
injectionCalled = &called
|
||||||
@ -144,4 +155,5 @@ func TestPlugethInjections(t *testing.T) {
|
|||||||
t.Fatalf("pluginNewSideBlock injection in blockChain.writeBlockAndSetHead() not called")
|
t.Fatalf("pluginNewSideBlock injection in blockChain.writeBlockAndSetHead() not called")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user