From 4fc9f889ad44e297b0c99ab0c3f7ce5f3b3f57ca Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 12 Dec 2023 17:30:42 +0100 Subject: [PATCH] dump witness sizes instead of loggin them to disk --- core/blockchain.go | 1 - core/state/state_witness.go | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 04ed4ac824..f58df07e44 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1852,7 +1852,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) } else { status, err = bc.writeBlockAndSetHead(block, receipts, logs, statedb, false) } - statedb.GetWitness().SetBlock(block) log.Info(fmt.Sprintf("block %d summary:\n%s", block.NumberU64(), statedb.GetWitness().Summary())) //state.DumpBlockWithWitnessToFile(statedb.GetWitness(), block) diff --git a/core/state/state_witness.go b/core/state/state_witness.go index 5269c44a73..6705a80b52 100644 --- a/core/state/state_witness.go +++ b/core/state/state_witness.go @@ -161,13 +161,9 @@ func (w Witness) Copy() Witness { panic("not implemented") } -func (w *Witness) Dump() { - for owner, al := range w.lists { - fmt.Printf("owner %x:\n", owner) - for path, node := range al { - fmt.Printf("%x: %x\n", []byte(path), node) - } - } +func (w *Witness) LogSizeWithBlock(b *types.Block) { + enc := w.EncodeRLP() + fmt.Printf("block %d witness+block size: %d\n", b.Number(), len(enc)) } func (w *Witness) Summary() string {