Merge branch 'patch-1' of https://github.com/hujw77/merkletreejs into hujw77-patch-1
This commit is contained in:
commit
740ed2aa11
|
@ -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.
|
||||
*/
|
||||
getMerkleProof (index: number) {
|
||||
if (index >= this.size) {
|
||||
if (index > this.size) {
|
||||
throw new Error('out of range')
|
||||
}
|
||||
if (!this.isLeaf(index)) {
|
||||
|
@ -276,7 +276,7 @@ export class MerkleMountainRange extends Base {
|
|||
cursor = index <= left ? left : right
|
||||
|
||||
// remaining node is the sibling
|
||||
siblings[height - 1] = this.hashes[index < left ? right : left]
|
||||
siblings[height - 1] = this.hashes[index <= left ? right : left]
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue