trie: added error handling
Created alternate versions of Trie and SecureTrie functions that can return a MissingNodeError (used by ODR services)
This commit is contained in:
@ -7,6 +7,8 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto/sha3"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/logger/glog"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
@ -39,7 +41,14 @@ func (t *Trie) Prove(key []byte) []rlp.RawValue {
|
||||
case nil:
|
||||
return nil
|
||||
case hashNode:
|
||||
tn = t.resolveHash(n)
|
||||
var err error
|
||||
tn, err = t.resolveHash(n, nil, nil)
|
||||
if err != nil {
|
||||
if glog.V(logger.Error) {
|
||||
glog.Errorf("Unhandled trie error: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
|
||||
}
|
||||
|
Reference in New Issue
Block a user