aboutsummaryrefslogtreecommitdiffstats
path: root/trie/proof.go
diff options
context:
space:
mode:
authorzsfelfoldi <zsfelfoldi@gmail.com>2015-11-26 01:28:21 +0800
committerzsfelfoldi <zsfelfoldi@gmail.com>2015-12-01 08:38:32 +0800
commit52904ae32f0a591e7dccad7827ff1c2a73c27026 (patch)
tree9d6804d5b7594e57adb83dfd271598e37b81065d /trie/proof.go
parent66d47ced4892141cdc955856b9fce6e95bca0402 (diff)
downloaddexon-52904ae32f0a591e7dccad7827ff1c2a73c27026.tar.gz
dexon-52904ae32f0a591e7dccad7827ff1c2a73c27026.tar.zst
dexon-52904ae32f0a591e7dccad7827ff1c2a73c27026.zip
trie: added error handling
Created alternate versions of Trie and SecureTrie functions that can return a MissingNodeError (used by ODR services)
Diffstat (limited to 'trie/proof.go')
-rw-r--r--trie/proof.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/trie/proof.go b/trie/proof.go
index a705c49db..2e88bb50b 100644
--- a/trie/proof.go
+++ b/trie/proof.go
@@ -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))
}