mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-07 16:13:07 +00:00
fix: improve mapping over blocks
This commit is contained in:
parent
6454446c1c
commit
857085fb08
@ -206,8 +206,8 @@ export class RLNContract {
|
|||||||
indexes.forEach((index) => {
|
indexes.forEach((index) => {
|
||||||
if (this._members.has(index)) {
|
if (this._members.has(index)) {
|
||||||
this._members.delete(index);
|
this._members.delete(index);
|
||||||
|
rlnInstance.zerokit.deleteMember(index);
|
||||||
}
|
}
|
||||||
rlnInstance.zerokit.deleteMember(index);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.merkleRootTracker.backFill(blockNumber);
|
this.merkleRootTracker.backFill(blockNumber);
|
||||||
@ -335,15 +335,13 @@ function splitToChunks(
|
|||||||
|
|
||||||
function* takeN<T>(array: T[], size: number): Iterable<T[]> {
|
function* takeN<T>(array: T[], size: number): Iterable<T[]> {
|
||||||
let start = 0;
|
let start = 0;
|
||||||
let skip = size;
|
|
||||||
|
|
||||||
while (skip < array.length) {
|
while (start < array.length) {
|
||||||
const portion = array.slice(start, skip);
|
const portion = array.slice(start, start + size);
|
||||||
|
|
||||||
yield portion;
|
yield portion;
|
||||||
|
|
||||||
start = skip;
|
start += size;
|
||||||
skip += size;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user