@@ -38,8 +38,8 @@ func writeProofLine(w io.Writer, prefix string, proof []byte) {
3838func TestSubtreeHashVectors (t * testing.T ) {
3939 tree := subtreeVectorTree ()
4040 h := sha256 .New ()
41- for end := 1 ; end <= subtreeVectorMax ; end ++ {
42- for start := 0 ; start < end ; start ++ {
41+ for end := 0 ; end <= subtreeVectorMax ; end ++ {
42+ for start := 0 ; start <= end ; start ++ {
4343 if ! IsValidSubtree (start , end ) {
4444 continue
4545 }
@@ -50,7 +50,7 @@ func TestSubtreeHashVectors(t *testing.T) {
5050 fmt .Fprintf (h , "[%d, %d) %x\n " , start , end , subtreeHash [:])
5151 }
5252 }
53- const want = "94a95384a8c69acea9b50d035a58285b3a777cb7a724005faa5e1f1e1190007f "
53+ const want = "b82806ad4265bb151c1119c0f4db437bb4d1a1f887b3a7fba1cd4ebf552e3e81 "
5454 if got := fmt .Sprintf ("%x" , h .Sum (nil )); got != want {
5555 t .Errorf ("subtree hash vector = %s, want %s" , got , want )
5656 }
@@ -59,8 +59,8 @@ func TestSubtreeHashVectors(t *testing.T) {
5959func TestSubtreeInclusionProofVectors (t * testing.T ) {
6060 tree := subtreeVectorTree ()
6161 h := sha256 .New ()
62- for end := 1 ; end <= subtreeVectorMax ; end ++ {
63- for start := 0 ; start < end ; start ++ {
62+ for end := 0 ; end <= subtreeVectorMax ; end ++ {
63+ for start := 0 ; start <= end ; start ++ {
6464 if ! IsValidSubtree (start , end ) {
6565 continue
6666 }
@@ -83,8 +83,8 @@ func TestSubtreeConsistencyProofVectors(t *testing.T) {
8383 tree := subtreeVectorTree ()
8484 h := sha256 .New ()
8585 for n := 0 ; n <= subtreeVectorMax ; n ++ {
86- for end := 1 ; end <= n ; end ++ {
87- for start := 0 ; start < end ; start ++ {
86+ for end := 0 ; end <= n ; end ++ {
87+ for start := 0 ; start <= end ; start ++ {
8888 if ! IsValidSubtree (start , end ) {
8989 continue
9090 }
@@ -96,28 +96,24 @@ func TestSubtreeConsistencyProofVectors(t *testing.T) {
9696 }
9797 }
9898 }
99- const want = "c586ebbb73a5621baf2140095d87dde934e3b6503a562a1a5215b8209edd083d "
99+ const want = "10fa99b37bf9bf9ffa26b412fbd98bd75363256d0b75d61bc4538b9c9c5a0a74 "
100100 if got := fmt .Sprintf ("%x" , h .Sum (nil )); got != want {
101101 t .Errorf ("subtree consistency proof vector = %s, want %s" , got , want )
102102 }
103103}
104104
105105func TestEfficientCoveringSubtreeVectors (t * testing.T ) {
106106 h := sha256 .New ()
107- for end := 1 ; end <= subtreeVectorMax ; end ++ {
108- for start := 0 ; start < end ; start ++ {
109- if IsValidSubtree (start , end ) {
110- fmt .Fprintf (h , "[%d, %d)\n " , start , end )
111- continue
112- }
107+ for end := 0 ; end <= subtreeVectorMax ; end ++ {
108+ for start := 0 ; start <= end ; start ++ {
113109 start1 , end1 , start2 , end2 , err := SubtreesForInterval (start , end )
114110 if err != nil {
115111 t .Fatalf ("SubtreesForInterval(%d, %d): %v" , start , end , err )
116112 }
117113 fmt .Fprintf (h , "[%d, %d) [%d, %d)\n " , start1 , end1 , start2 , end2 )
118114 }
119115 }
120- const want = "e0aecb912a10c57d753b6ecc64db73217f9bc4ed10fcb4e9062be3b6fbe1ebfd "
116+ const want = "7fd9c8b926e9d2b5cf831560e8ce295a5ef97ad5c5ede4ea0dea28a8c8fc8bb0 "
121117 if got := fmt .Sprintf ("%x" , h .Sum (nil )); got != want {
122118 t .Errorf ("efficient covering subtree vector = %s, want %s" , got , want )
123119 }
0 commit comments