Skip to content

Commit c712beb

Browse files
committed
feat: added retry and block by step fetch log
1 parent 106e1da commit c712beb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/common/execution-provider/execution-provider.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ export class ExecutionProviderService {
5757
blockStep = this.configService.get('EL_BLOCK_STEP'),
5858
): Promise<Log[]> {
5959
let logs: Log[] = [];
60-
const latestBlock = await this.provider.getBlockNumber();
61-
62-
const fromBlock = Number(filter.fromBlock) ?? 0;
63-
const toBlock = typeof filter.toBlock === 'string' ? latestBlock : Number(filter.toBlock);
60+
const toBlock =
61+
typeof filter.toBlock === 'number' ? filter.toBlock : (await this.provider.getBlock(filter.toBlock)).number;
62+
const fromBlock =
63+
typeof filter.fromBlock === 'number' ? filter.fromBlock : (await this.provider.getBlock(filter.fromBlock)).number;
6464

6565
for (let startBlock = fromBlock; startBlock <= toBlock; startBlock += blockStep) {
6666
const endBlock = Math.min(startBlock + blockStep - 1, toBlock);

0 commit comments

Comments
 (0)