Merge branch 'patch-1' of https://github.com/hujw77/merkletreejs into hujw77-patch-1

This commit is contained in:
Miguel Mota 2021-07-25 23:43:31 -07:00
commit 740ed2aa11
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9
1 changed files with 2 additions and 2 deletions

View File

@ -236,7 +236,7 @@ export class MerkleMountainRange extends Base {
* @desc It returns a merkle proof for a leaf. Note that the index starts from 1. * @desc It returns a merkle proof for a leaf. Note that the index starts from 1.
*/ */
getMerkleProof (index: number) { getMerkleProof (index: number) {
if (index >= this.size) { if (index > this.size) {
throw new Error('out of range') throw new Error('out of range')
} }
if (!this.isLeaf(index)) { if (!this.isLeaf(index)) {
@ -276,7 +276,7 @@ export class MerkleMountainRange extends Base {
cursor = index <= left ? left : right cursor = index <= left ? left : right
// remaining node is the sibling // remaining node is the sibling
siblings[height - 1] = this.hashes[index < left ? right : left] siblings[height - 1] = this.hashes[index <= left ? right : left]
} }
return { return {