Skip to content

Commit 4325419

Browse files
committed
trie: remove panics
1 parent 405b06a commit 4325419

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

trie/committer.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ func (c *committer) Commit(n node, db *Database) (hashNode, error) {
8888
if err != nil {
8989
return nil, err
9090
}
91-
hn, ok := h.(hashNode)
92-
if !ok {
93-
panic("commit did not hash down to a hashnode!")
94-
}
95-
return hn, nil
91+
return h.(hashNode), nil
9692
}
9793

9894
// commit collapses a node down into a hash node and inserts it into the database

trie/trie.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,6 @@ func (t *Trie) Commit(onleaf LeafCallback) (root common.Hash, err error) {
451451
if err != nil {
452452
return common.Hash{}, err
453453
}
454-
if common.BytesToHash(newRoot) != rootHash {
455-
panic(fmt.Sprintf("Committed root %x != roothash %x", newRoot, rootHash))
456-
}
457454
t.root = newRoot
458455
return rootHash, nil
459456
}

0 commit comments

Comments
 (0)