Skip to content

Commit

Permalink
refactor: move trieDB creation outside of block-making loop (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed May 7, 2024
1 parent a130105 commit 9d69f35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 9d69f35

Please sign in to comment.