@@ -671,20 +671,20 @@ func isTxExt(proofEl []byte) bool {
671
671
672
672
func printProof (ps [][]byte , t , idx []byte ) {
673
673
674
- enable := byte (200 )
674
+ enable := byte (150 )
675
675
fmt .Print (" [" )
676
676
for i , p := range ps {
677
677
if t [i ] == extNode {
678
678
fmt .Print ("EXT - " )
679
- if idx [0 ] > enable {
679
+ if idx [0 ] >= enable {
680
680
fmt .Print (" (" , p , ") - " )
681
681
}
682
682
} else if t [i ] == branchNode {
683
683
fmt .Print ("BRANCH - " )
684
684
// fmt.Print(" (", p, ") - ")
685
685
} else if t [i ] == leafNode {
686
686
fmt .Print ("LEAF - " )
687
- if idx [0 ] > enable {
687
+ if idx [0 ] >= enable {
688
688
fmt .Print (" (" , p , ") - " )
689
689
}
690
690
} else if t [i ] == hashedNode {
@@ -706,7 +706,6 @@ func (st *StackTrie) UpdateAndGetProof(db ethdb.KeyValueReader, indexBuf, value
706
706
if err != nil {
707
707
return StackProof {}, err
708
708
}
709
- len1 := len (proofS )
710
709
printProof (proofS , typesS , indexBuf )
711
710
712
711
st .Update (indexBuf , value )
@@ -715,14 +714,8 @@ func (st *StackTrie) UpdateAndGetProof(db ethdb.KeyValueReader, indexBuf, value
715
714
if err != nil {
716
715
return StackProof {}, err
717
716
}
718
- len2 := len (proofC )
719
717
printProof (proofC , typesC , indexBuf )
720
718
721
- // fmt.Println(len1, len2)
722
- if len1 > len2 {
723
- fmt .Println (KeybytesToHex (indexBuf ))
724
- }
725
-
726
719
return StackProof {proofS , proofC , nibblesS , nibblesC , typesS , typesC }, nil
727
720
}
728
721
@@ -806,7 +799,7 @@ func (st *StackTrie) GetProof(db ethdb.KeyValueReader, key []byte) ([][]byte, []
806
799
// fmt.Print(" ", k[i], "/", c.nodeType, " | ")
807
800
proofType = append (proofType , c .nodeType )
808
801
if c .nodeType == extNode {
809
- fmt .Print (c .key , " " )
802
+ // fmt.Print(c.key, " ")
810
803
i += len (c .key ) - 1
811
804
nodes = append (nodes , c )
812
805
c = c .children [0 ]
@@ -825,19 +818,18 @@ func (st *StackTrie) GetProof(db ethdb.KeyValueReader, key []byte) ([][]byte, []
825
818
panic (error )
826
819
}
827
820
828
- if c_rlp [0 ] > 192 && c_rlp [0 ] < 248 {
829
- numNibbles := c_rlp [0 ] - 225
830
- var nibble = make ([]byte , numNibbles )
831
- for i := 0 ; i < int (numNibbles ); i ++ {
832
- nibble [i ] = c_rlp [i + 1 ] - 16
833
- }
834
- // fmt.Println(" HASHED Ext nibble:", nibble, c_rlp)
835
- nibbles = append (nibbles , nibble )
836
- }
821
+ // if c_rlp[0] > 192 && c_rlp[0] < 248 {
822
+ // numNibbles := c_rlp[0] - 225
823
+ // var nibble = make([]byte, numNibbles)
824
+ // for i := 0; i < int(numNibbles); i++ {
825
+ // nibble[i] = c_rlp[i+1] - 16
826
+ // }
827
+ // // fmt.Println(" HASHED Ext nibble:", nibble, c_rlp)
828
+ // }
837
829
838
- fmt .Print (" hashed node key:" , c .key , " " )
839
830
// fmt.Println(" c_rlp:", c_rlp)
840
831
proof = append (proof , c_rlp )
832
+ nibbles = append (nibbles , c .key )
841
833
branchChild := st .getNodeFromBranchRLP (c_rlp , int (k [i ]))
842
834
// branchChild is of length 1 when there is no child at this position in the branch
843
835
// (`branchChild = [128]` in this case), but it is also of length 1 when `c_rlp` is a leaf.
@@ -886,11 +878,11 @@ func (st *StackTrie) GetProof(db ethdb.KeyValueReader, key []byte) ([][]byte, []
886
878
// if it's an ext node, it contains 1.)nibbles and 2.) 32bytes hashed value
887
879
// 2.) 32 bytes long data plus rlp flag, it becomes 33 bytes long data
888
880
// 192 + 33 = 225, and the left bytes are for nibbles.
889
- numNibbles := raw_rlp [0 ] - 225
890
- var nibble = make ([]byte , numNibbles )
891
- for i := 0 ; i < int (numNibbles ); i ++ {
892
- nibble [i ] = raw_rlp [i + 1 ] - 16
893
- }
881
+ // numNibbles := raw_rlp[0] - 225
882
+ // var nibble = make([]byte, numNibbles)
883
+ // for i := 0; i < int(numNibbles); i++ {
884
+ // nibble[i] = raw_rlp[i+1] - 16
885
+ // }
894
886
// fmt.Println(" Ext nibble:", numNibbles, node.key)
895
887
nibbles = append (nibbles , node .key )
896
888
} else {
0 commit comments