From 9d69f35720f0914489576142b2d06a5520b42ba6 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:12:52 +0100 Subject: [PATCH] refactor: move trieDB creation outside of block-making loop (#354) --- core/chain_makers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/chain_makers.go b/core/chain_makers.go index 0b262cba16fc..37a5fbf5100f 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -429,9 +429,9 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine return nil, nil } var snaps *snapshot.Tree + triedb := state.NewDatabaseWithConfig(db, nil) + triedb.EndVerkleTransition() for i := 0; i < n; i++ { - triedb := state.NewDatabaseWithConfig(db, nil) - triedb.EndVerkleTransition() statedb, err := state.New(parent.Root(), triedb, snaps) if err != nil { panic(fmt.Sprintf("could not find state for block %d: err=%v, parent root=%x", i, err, parent.Root()))