From 748d1c171d74fbf6b6051fd629d3c2204dd930e3 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Thu, 19 May 2016 13:24:14 +0300 Subject: core, core/state, trie: enterprise hand-tuned multi-level caching --- trie/proof.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'trie/proof.go') 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 -- cgit