aboutsummaryrefslogtreecommitdiffstats
path: root/trie/proof.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-05-19 18:24:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-05-26 21:33:09 +0800
commit748d1c171d74fbf6b6051fd629d3c2204dd930e3 (patch)
treef3bc5352efadae61cb39afd33ceeaba7b824609c /trie/proof.go
parenta7434fd0085f55235acea5348db0c9247e9aac10 (diff)
downloaddexon-748d1c171d74fbf6b6051fd629d3c2204dd930e3.tar.gz
dexon-748d1c171d74fbf6b6051fd629d3c2204dd930e3.tar.zst
dexon-748d1c171d74fbf6b6051fd629d3c2204dd930e3.zip
core, core/state, trie: enterprise hand-tuned multi-level caching
Diffstat (limited to 'trie/proof.go')
-rw-r--r--trie/proof.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/trie/proof.go b/trie/proof.go
index 37a70fb34..5135de047 100644
--- a/trie/proof.go
+++ b/trie/proof.go
@@ -54,7 +54,7 @@ func (t *Trie) Prove(key []byte) []rlp.RawValue {
}
nodes = append(nodes, n)
case fullNode:
- tn = n[key[0]]
+ tn = n.Children[key[0]]
key = key[1:]
nodes = append(nodes, n)
case hashNode:
@@ -77,7 +77,7 @@ func (t *Trie) Prove(key []byte) []rlp.RawValue {
for i, n := range nodes {
// Don't bother checking for errors here since hasher panics
// if encoding doesn't work and we're not writing to any database.
- n, _ = t.hasher.replaceChildren(n, nil)
+ n, _, _ = t.hasher.hashChildren(n, nil)
hn, _ := t.hasher.store(n, nil, false)
if _, ok := hn.(hashNode); ok || i == 0 {
// If the node's database encoding is a hash (or is the
@@ -103,7 +103,7 @@ func VerifyProof(rootHash common.Hash, key []byte, proof []rlp.RawValue) (value
if !bytes.Equal(sha.Sum(nil), wantHash) {
return nil, fmt.Errorf("bad proof node %d: hash mismatch", i)
}
- n, err := decodeNode(buf)
+ n, err := decodeNode(wantHash, buf)
if err != nil {
return nil, fmt.Errorf("bad proof node %d: %v", i, err)
}
@@ -139,7 +139,7 @@ func get(tn node, key []byte) ([]byte, node) {
tn = n.Val
key = key[len(n.Key):]
case fullNode:
- tn = n[key[0]]
+ tn = n.Children[key[0]]
key = key[1:]
case hashNode:
return key, n