From fbd31474e6ddb7cb363a8837a93c4d200cc4b9d1 Mon Sep 17 00:00:00 2001 From: belopash Date: Fri, 1 Nov 2024 13:43:25 +0500 Subject: [PATCH] save --- test/erc20-transfers/src/processor.ts | 5 ++--- util/util-internal-ingest-tools/src/archive.ts | 11 +++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/test/erc20-transfers/src/processor.ts b/test/erc20-transfers/src/processor.ts index aede83036..f03ac16f0 100644 --- a/test/erc20-transfers/src/processor.ts +++ b/test/erc20-transfers/src/processor.ts @@ -9,10 +9,10 @@ const CONTRACT = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase() const processor = new EvmBatchProcessor() .setPortal({ - url: 'https://portal.sqd.dev/datasets/ethereum-mainnet', + url: 'http://localhost:8000/datasets/ethereum-mainnet', bufferThreshold: 100 * 1024 * 1024 }) - // .setRpcEndpoint(process.env.ARB_NODE_WS) + .setRpcEndpoint('https://rpc.ankr.com/eth') .setFinalityConfirmation(500) .setBlockRange({from: 0}) .setFields({ @@ -28,7 +28,6 @@ const processor = new EvmBatchProcessor() processor.run(new TypeormDatabase({supportHotBlocks: true}), async ctx => { let transfers: Transfer[] = [] - for (let block of ctx.blocks) { for (let log of block.logs) { if (log.address == CONTRACT && erc20.events.Transfer.is(log)) { diff --git a/util/util-internal-ingest-tools/src/archive.ts b/util/util-internal-ingest-tools/src/archive.ts index b0d4872fa..82c16f6aa 100644 --- a/util/util-internal-ingest-tools/src/archive.ts +++ b/util/util-internal-ingest-tools/src/archive.ts @@ -49,9 +49,6 @@ export function archiveIngest(args: ArchiveIngestOptions): Asyn let beg = req.range.from let end = req.range.to ?? Infinity if (client.stream) { - if (top < beg) { - top = await height.get() - } if (top < beg && stopOnHead) return for await (let blocks of client.stream({ @@ -63,16 +60,14 @@ export function archiveIngest(args: ArchiveIngestOptions): Asyn let lastBlock = last(blocks).header.number assert(lastBlock >= beg) beg = lastBlock + 1 - - if (top < beg) { - top = await height.get() - } - + yield { blocks, isHead: beg > top } + top = await height.get() + if (top < beg && stopOnHead) return } } else {