@@ -671,20 +671,20 @@ func isTxExt(proofEl []byte) bool {
671671
672672func printProof (ps [][]byte , t , idx []byte ) {
673673
674- enable := byte (200 )
674+ enable := byte (150 )
675675 fmt .Print (" [" )
676676 for i , p := range ps {
677677 if t [i ] == extNode {
678678 fmt .Print ("EXT - " )
679- if idx [0 ] > enable {
679+ if idx [0 ] >= enable {
680680 fmt .Print (" (" , p , ") - " )
681681 }
682682 } else if t [i ] == branchNode {
683683 fmt .Print ("BRANCH - " )
684684 // fmt.Print(" (", p, ") - ")
685685 } else if t [i ] == leafNode {
686686 fmt .Print ("LEAF - " )
687- if idx [0 ] > enable {
687+ if idx [0 ] >= enable {
688688 fmt .Print (" (" , p , ") - " )
689689 }
690690 } else if t [i ] == hashedNode {
@@ -706,7 +706,6 @@ func (st *StackTrie) UpdateAndGetProof(db ethdb.KeyValueReader, indexBuf, value
706706 if err != nil {
707707 return StackProof {}, err
708708 }
709- len1 := len (proofS )
710709 printProof (proofS , typesS , indexBuf )
711710
712711 st .Update (indexBuf , value )
@@ -715,14 +714,8 @@ func (st *StackTrie) UpdateAndGetProof(db ethdb.KeyValueReader, indexBuf, value
715714 if err != nil {
716715 return StackProof {}, err
717716 }
718- len2 := len (proofC )
719717 printProof (proofC , typesC , indexBuf )
720718
721- // fmt.Println(len1, len2)
722- if len1 > len2 {
723- fmt .Println (KeybytesToHex (indexBuf ))
724- }
725-
726719 return StackProof {proofS , proofC , nibblesS , nibblesC , typesS , typesC }, nil
727720}
728721
@@ -806,7 +799,7 @@ func (st *StackTrie) GetProof(db ethdb.KeyValueReader, key []byte) ([][]byte, []
806799 // fmt.Print(" ", k[i], "/", c.nodeType, " | ")
807800 proofType = append (proofType , c .nodeType )
808801 if c .nodeType == extNode {
809- fmt .Print (c .key , " " )
802+ // fmt.Print(c.key, " ")
810803 i += len (c .key ) - 1
811804 nodes = append (nodes , c )
812805 c = c .children [0 ]
@@ -825,19 +818,18 @@ func (st *StackTrie) GetProof(db ethdb.KeyValueReader, key []byte) ([][]byte, []
825818 panic (error )
826819 }
827820
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+ // }
837829
838- fmt .Print (" hashed node key:" , c .key , " " )
839830 // fmt.Println(" c_rlp:", c_rlp)
840831 proof = append (proof , c_rlp )
832+ nibbles = append (nibbles , c .key )
841833 branchChild := st .getNodeFromBranchRLP (c_rlp , int (k [i ]))
842834 // branchChild is of length 1 when there is no child at this position in the branch
843835 // (`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, []
886878 // if it's an ext node, it contains 1.)nibbles and 2.) 32bytes hashed value
887879 // 2.) 32 bytes long data plus rlp flag, it becomes 33 bytes long data
888880 // 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+ // }
894886 // fmt.Println(" Ext nibble:", numNibbles, node.key)
895887 nibbles = append (nibbles , node .key )
896888 } else {
0 commit comments