trie: remove panics

This commit is contained in:
Martin Holst Swende 2020-01-29 09:40:52 +01:00
parent 405b06a6a6
commit 4325419711
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 1 additions and 8 deletions

View file

@ -88,11 +88,7 @@ func (c *committer) Commit(n node, db *Database) (hashNode, error) {
if err != nil {
return nil, err
}
hn, ok := h.(hashNode)
if !ok {
panic("commit did not hash down to a hashnode!")
}
return hn, nil
return h.(hashNode), nil
}
// commit collapses a node down into a hash node and inserts it into the database

View file

@ -451,9 +451,6 @@ func (t *Trie) Commit(onleaf LeafCallback) (root common.Hash, err error) {
if err != nil {
return common.Hash{}, err
}
if common.BytesToHash(newRoot) != rootHash {
panic(fmt.Sprintf("Committed root %x != roothash %x", newRoot, rootHash))
}
t.root = newRoot
return rootHash, nil
}