Skip to content

Commit

Permalink
Merge pull request #352 from theStack/202004-forestproofs_fix_offbyon…
Browse files Browse the repository at this point in the history
…e_pos_numleaves_sanity_check

accumulator/forestproofs: fix off-by-one error in `Prove` sanity check
  • Loading branch information
adiabat authored Apr 18, 2022
2 parents 1ff40de + 80599dc commit 1cd8886
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion accumulator/forestproofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (f *Forest) Prove(wanted Hash) (Proof, error) {
}

// should never happen
if pos > f.numLeaves {
if pos >= f.numLeaves {
return pr, fmt.Errorf("prove: got leaf position %d but only %d leaves exist",
pos, f.numLeaves)
}
Expand Down

0 comments on commit 1cd8886

Please sign in to comment.