diff --git a/core/chain_makers.go b/core/chain_makers.go index af55716cca..ebf0ca59f8 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -472,7 +472,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse // then generate chain on top. func GenerateChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (ethdb.Database, []*types.Block, []types.Receipts) { db := rawdb.NewMemoryDatabase() - triedb := triedb.NewDatabase(db, triedb.HashDefaults) + triedb := triedb.NewDatabase(db, triedb.VerkleDefaults) defer triedb.Close() _, err := genesis.Commit(db, triedb) if err != nil { diff --git a/trie/bintrie/hashed_node.go b/trie/bintrie/hashed_node.go index a677f81a69..e4d8c2e7ac 100644 --- a/trie/bintrie/hashed_node.go +++ b/trie/bintrie/hashed_node.go @@ -81,6 +81,7 @@ func (h HashedNode) toDot(parent string, path string) string { } func (h HashedNode) CollectNodes([]byte, NodeFlushFn) error { + // HashedNodes are already persisted in the database and don't need to be collected. return nil } diff --git a/trie/bintrie/trie.go b/trie/bintrie/trie.go index dc3a842c56..a7ee342b74 100644 --- a/trie/bintrie/trie.go +++ b/trie/bintrie/trie.go @@ -329,7 +329,7 @@ func (t *BinaryTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet) { // The root can be any type of BinaryNode (InternalNode, StemNode, etc.) err := t.root.CollectNodes(nil, func(path []byte, node BinaryNode) { serialized := SerializeNode(node) - nodeset.AddNode(path, trienode.NewNodeWithPrev(common.Hash{}, serialized, t.tracer.Get(path))) + nodeset.AddNode(path, trienode.NewNodeWithPrev(node.Hash(), serialized, t.tracer.Get(path))) }) if err != nil { panic(fmt.Errorf("CollectNodes failed: %v", err))