aboutsummaryrefslogtreecommitdiffstats
path: root/trie/proof.go
diff options
context:
space:
mode:
authorkiel barry <kiel.j.barry@gmail.com>2018-05-22 04:41:31 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-22 04:41:31 +0800
commit0fe47e98c4d93f952dc7415f401fd03b2664a21d (patch)
treeae30e450e853fe8a03760496b87259077a760e68 /trie/proof.go
parent415969f534d8122e717e18abafdc8ec7bb913a84 (diff)
downloadgo-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.gz
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.bz2
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.lz
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.xz
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.zst
go-tangerine-0fe47e98c4d93f952dc7415f401fd03b2664a21d.zip
trie: fixes to comply with golint (#16771)
Diffstat (limited to 'trie/proof.go')
-rw-r--r--trie/proof.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/trie/proof.go b/trie/proof.go
index 508e4a6cf..6cb8f4d5f 100644
--- a/trie/proof.go
+++ b/trie/proof.go
@@ -102,28 +102,28 @@ func (t *SecureTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.Putter) err
// VerifyProof checks merkle proofs. The given proof must contain the value for
// key in a trie with the given root hash. VerifyProof returns an error if the
// proof contains invalid trie nodes or the wrong value.
-func VerifyProof(rootHash common.Hash, key []byte, proofDb DatabaseReader) (value []byte, err error, nodes int) {
+func VerifyProof(rootHash common.Hash, key []byte, proofDb DatabaseReader) (value []byte, nodes int, err error) {
key = keybytesToHex(key)
wantHash := rootHash
for i := 0; ; i++ {
buf, _ := proofDb.Get(wantHash[:])
if buf == nil {
- return nil, fmt.Errorf("proof node %d (hash %064x) missing", i, wantHash), i
+ return nil, i, fmt.Errorf("proof node %d (hash %064x) missing", i, wantHash)
}
n, err := decodeNode(wantHash[:], buf, 0)
if err != nil {
- return nil, fmt.Errorf("bad proof node %d: %v", i, err), i
+ return nil, i, fmt.Errorf("bad proof node %d: %v", i, err)
}
keyrest, cld := get(n, key)
switch cld := cld.(type) {
case nil:
// The trie doesn't contain the key.
- return nil, nil, i
+ return nil, i, nil
case hashNode:
key = keyrest
copy(wantHash[:], cld)
case valueNode:
- return cld, nil, i + 1
+ return cld, i + 1, nil
}
}
}