trie: panic if BatchSerialize returns an error in Verkle trie Commit

This commit is contained in:
Jared Wasinger 2024-06-07 12:17:42 -07:00
parent 215ed946b5
commit 886fe1ab03

View file

@ -219,7 +219,12 @@ func (t *VerkleTrie) Hash() common.Hash {
// Commit writes all nodes to the tree's memory database.
func (t *VerkleTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet) {
root := t.root.(*verkle.InternalNode)
nodes, _ := root.BatchSerialize()
nodes, err := root.BatchSerialize()
if err != nil {
// error return from this function indicates error in the code logic
// of BatchSerialize, and we fail catastrophically if this is the case.
panic(fmt.Errorf("BatchSerialize failed: %v", err))
}
nodeset := trienode.NewNodeSet(common.Hash{})
for _, node := range nodes {
// hash parameter is not used in pathdb