@@ -30,46 +30,7 @@ func CalcInclusionProofNodeAddresses(treeSize, index int64, maxBitLen int) ([]No
3030 return []NodeFetch {}, fmt .Errorf ("invalid params ts: %d index: %d, bitlen:%d" , treeSize , index , maxBitLen )
3131 }
3232
33- proof := make ([]NodeFetch , 0 , bitLen (treeSize )+ 1 )
34-
35- sizeLessOne := treeSize - 1
36-
37- if bitLen (treeSize ) == 0 || index > sizeLessOne {
38- return proof , nil
39- }
40-
41- node := index
42- depth := 0
43- lastNodeAtLevel := sizeLessOne
44-
45- for depth < bitLen (sizeLessOne ) {
46- sibling := node ^ 1
47- if sibling < lastNodeAtLevel {
48- // Tree must be completely filled in up to this node index
49- n , err := storage .NewNodeIDForTreeCoords (int64 (depth ), sibling , maxBitLen )
50- if err != nil {
51- return nil , err
52- }
53- proof = append (proof , NodeFetch {NodeID : n })
54- } else if sibling == lastNodeAtLevel {
55- // We're working in the same node coordinate space as the C++ reference implementation
56- // (depth, index) but intermediate nodes with only one child are not written by our storage.
57- // In these cases the value that we want is a copy of a node further down (multiple levels
58- // may be skipped).
59- l , sibling := skipMissingLevels (treeSize , lastNodeAtLevel , depth , node )
60- n , err := storage .NewNodeIDForTreeCoords (int64 (l ), sibling , maxBitLen )
61- if err != nil {
62- return nil , err
63- }
64- proof = append (proof , NodeFetch {NodeID : n })
65- }
66-
67- node = node >> 1
68- lastNodeAtLevel = lastNodeAtLevel >> 1
69- depth ++
70- }
71-
72- return proof , nil
33+ return pathFromNodeToRootAtSnapshot (index , 0 , treeSize , maxBitLen )
7334}
7435
7536// CalcConsistencyProofNodeAddresses returns the tree node IDs needed to
0 commit comments