From 4325419711f285e7d180ca00edae3030765c8c05 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 29 Jan 2020 09:40:52 +0100 Subject: [PATCH] trie: remove panics --- trie/committer.go | 6 +----- trie/trie.go | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/trie/committer.go b/trie/committer.go index 7f51d91823..eacefdff11 100644 --- a/trie/committer.go +++ b/trie/committer.go @@ -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 diff --git a/trie/trie.go b/trie/trie.go index 2e27f4f105..dd26f9b340 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -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 }