diff --git a/src/contract/rln_contract.ts b/src/contract/rln_contract.ts index 0533436..65ca2ed 100644 --- a/src/contract/rln_contract.ts +++ b/src/contract/rln_contract.ts @@ -206,8 +206,8 @@ export class RLNContract { indexes.forEach((index) => { if (this._members.has(index)) { this._members.delete(index); + rlnInstance.zerokit.deleteMember(index); } - rlnInstance.zerokit.deleteMember(index); }); this.merkleRootTracker.backFill(blockNumber); @@ -335,15 +335,13 @@ function splitToChunks( function* takeN(array: T[], size: number): Iterable { let start = 0; - let skip = size; - while (skip < array.length) { - const portion = array.slice(start, skip); + while (start < array.length) { + const portion = array.slice(start, start + size); yield portion; - start = skip; - skip += size; + start += size; } }