for (let from = START_BLOCK; from <= head; from += RANGE) {
const to = Math.min(from + RANGE - 1, head);
const logs = await getPressChainLogs(from, to);
await database.transaction(async (tx) => {
for (const log of logs) {
await applyEventIdempotently(tx, log);
}
await saveCursor(tx, to, await blockHash(to));
});
}