File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ func (rp RowProof) Validate(root []byte) error {
36
36
}
37
37
if len (rp .Proofs ) != 0 &&
38
38
(int64 (rp .StartRow ) != rp .Proofs [0 ].Index ||
39
- int64 (rp .StartRow ) != rp .Proofs [len (rp .Proofs )- 1 ].Index ) {
39
+ int64 (rp .EndRow ) != rp .Proofs [len (rp .Proofs )- 1 ].Index ) {
40
40
return fmt .Errorf ("invalid start/end row" )
41
41
}
42
42
if ! rp .VerifyProof (root ) {
Original file line number Diff line number Diff line change @@ -59,6 +59,26 @@ func TestRowProofValidate(t *testing.T) {
59
59
root : root ,
60
60
wantErr : true ,
61
61
},
62
+ {
63
+ name : "invalid start row" ,
64
+ rp : func () RowProof {
65
+ proof := validRowProof ()
66
+ proof .StartRow += 1
67
+ return proof
68
+ }(),
69
+ root : root ,
70
+ wantErr : true ,
71
+ },
72
+ {
73
+ name : "invalid end row" ,
74
+ rp : func () RowProof {
75
+ proof := validRowProof ()
76
+ proof .EndRow += 1
77
+ return proof
78
+ }(),
79
+ root : root ,
80
+ wantErr : true ,
81
+ },
62
82
}
63
83
for _ , tc := range testCases {
64
84
t .Run (tc .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments