mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
trie: panic if BatchSerialize returns an error in Verkle trie Commit
This commit is contained in:
parent
215ed946b5
commit
886fe1ab03
1 changed files with 6 additions and 1 deletions
|
|
@ -219,7 +219,12 @@ func (t *VerkleTrie) Hash() common.Hash {
|
||||||
// Commit writes all nodes to the tree's memory database.
|
// Commit writes all nodes to the tree's memory database.
|
||||||
func (t *VerkleTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet) {
|
func (t *VerkleTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet) {
|
||||||
root := t.root.(*verkle.InternalNode)
|
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{})
|
nodeset := trienode.NewNodeSet(common.Hash{})
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
// hash parameter is not used in pathdb
|
// hash parameter is not used in pathdb
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue