Skip to content

Commit

Permalink
fix: improve mapping over blocks (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
weboko committed Mar 5, 2024
1 parent 6454446 commit 3dc5908
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/contract/rln_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -335,15 +335,13 @@ function splitToChunks(

function* takeN<T>(array: T[], size: number): Iterable<T[]> {
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;
}
}

Expand Down

0 comments on commit 3dc5908

Please sign in to comment.