From 23c0ca58af42b38c20085fe0eee6553689778410 Mon Sep 17 00:00:00 2001 From: philip-morlier Date: Tue, 13 Jun 2023 13:13:13 -0700 Subject: [PATCH] trieFlushClone test experiment --- core/blockchain.go | 1 + core/plugeth_injection_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index b31f915bc..0c5836bb9 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1334,6 +1334,7 @@ func (bc *BlockChain) writeKnownBlock(block *types.Block) error { // writeBlockWithState writes block, metadata and corresponding state data to the // database. 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 ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1) if ptd == nil { diff --git a/core/plugeth_injection_test.go b/core/plugeth_injection_test.go index 06c10f51b..08108f242 100644 --- a/core/plugeth_injection_test.go +++ b/core/plugeth_injection_test.go @@ -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) { called := false injectionCalled = &called @@ -144,4 +155,5 @@ func TestPlugethInjections(t *testing.T) { t.Fatalf("pluginNewSideBlock injection in blockChain.writeBlockAndSetHead() not called") } }) + } \ No newline at end of file