Skip to content

Commit 1e6cc1f

Browse files
committed
fix remaining tests
1 parent a26a5d5 commit 1e6cc1f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

trie/iterator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (it *nodeIterator) Leaf() bool {
215215

216216
func (it *nodeIterator) LeafKey() []byte {
217217
if len(it.stack) > 0 {
218-
if _, ok := it.stack[len(it.stack)-1].node.(valueNode); ok {
218+
if _, ok := it.stack[len(it.stack)-1].node.(*valueNode); ok {
219219
return hexToKeybytes(it.path)
220220
}
221221
}
@@ -233,7 +233,7 @@ func (it *nodeIterator) LeafBlob() []byte {
233233

234234
func (it *nodeIterator) LeafProof() [][]byte {
235235
if len(it.stack) > 0 {
236-
if _, ok := it.stack[len(it.stack)-1].node.(valueNode); ok {
236+
if _, ok := it.stack[len(it.stack)-1].node.(*valueNode); ok {
237237
hasher := newHasher(false)
238238
defer returnHasherToPool(hasher)
239239
proofs := make([][]byte, 0, len(it.stack))

trie/proof.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func VerifyProof(rootHash common.Hash, key []byte, proofDb ethdb.KeyValueReader)
128128
case hashNode:
129129
key = keyrest
130130
copy(wantHash[:], cld)
131-
case valueNode:
131+
case *valueNode:
132132
return cld.resolve(), nil
133133
}
134134
}
@@ -191,7 +191,7 @@ func proofToPath(rootHash common.Hash, root node, key []byte, proofDb ethdb.KeyV
191191
if err != nil {
192192
return nil, nil, err
193193
}
194-
case valueNode:
194+
case *valueNode:
195195
valnode = cld.resolve()
196196
}
197197
// Link the parent and child.
@@ -298,7 +298,7 @@ findFork:
298298
}
299299
// Only one proof points to non-existent key.
300300
if shortForkRight != 0 {
301-
if _, ok := rn.Val.(valueNode); ok {
301+
if _, ok := rn.Val.(*valueNode); ok {
302302
// The fork point is root node, unset the entire trie
303303
if parent == nil {
304304
return true, nil
@@ -309,7 +309,7 @@ findFork:
309309
return false, unset(rn, rn.Val, left[pos:], len(rn.Key), false)
310310
}
311311
if shortForkLeft != 0 {
312-
if _, ok := rn.Val.(valueNode); ok {
312+
if _, ok := rn.Val.(*valueNode); ok {
313313
// The fork point is root node, unset the entire trie
314314
if parent == nil {
315315
return true, nil
@@ -396,7 +396,7 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error
396396
}
397397
return nil
398398
}
399-
if _, ok := cld.Val.(valueNode); ok {
399+
if _, ok := cld.Val.(*valueNode); ok {
400400
fn := parent.(*fullNode)
401401
fn.Children[key[pos-1]] = nil
402402
return nil
@@ -432,7 +432,7 @@ func hasRightElement(node node, key []byte) bool {
432432
return bytes.Compare(rn.Key, key[pos:]) > 0
433433
}
434434
node, pos = rn.Val, pos+len(rn.Key)
435-
case valueNode:
435+
case *valueNode:
436436
return false // We have resolved the whole path
437437
default:
438438
panic(fmt.Sprintf("%T: invalid node: %v", node, node)) // hashnode
@@ -612,7 +612,7 @@ func get(tn node, key []byte, skipResolved bool) ([]byte, node) {
612612
return key, n
613613
case nil:
614614
return key, nil
615-
case valueNode:
615+
case *valueNode:
616616
return nil, n
617617
default:
618618
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))

trie/trie.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (t *Trie) getNode(origNode node, path []byte, pos int) (item []byte, newnod
322322
}
323323
// Path still needs to be traversed, descend into children
324324
switch n := (origNode).(type) {
325-
case valueNode:
325+
case *valueNode:
326326
// Path prematurely ended, abort
327327
return nil, nil, 0, nil
328328

@@ -627,7 +627,7 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
627627
// n still contains at least two values and cannot be reduced.
628628
return true, n, nil
629629

630-
case valueNode:
630+
case *valueNode:
631631
return true, nil, nil
632632

633633
case nil:

0 commit comments

Comments
 (0)