From 64546b233c825287cab18d2a385e5e25e749033e Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sun, 31 Jul 2022 10:10:22 -0700 Subject: [PATCH] use timestamps of relative blocks, not "now" --- src/scraper.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scraper.js b/src/scraper.js index 9a14c80..500f650 100644 --- a/src/scraper.js +++ b/src/scraper.js @@ -106,7 +106,8 @@ class Scrape extends Collection { while (lastScrapedBlock >= latestEthBlock) { latestEthBlock = await this.provider.getBlockNumber(); - console.log(`[ ${(new Date()).toISOString()} ][ ${this.contractName} ] [ waiting ]\n`) + const timestamp = await this.getBlockTimestamp(latestEthBlock); + console.log(`[ ${timestamp.toISOString()} ][ ${this.contractName} ] [ waiting ]\n`) await sleep(120); } } @@ -115,7 +116,8 @@ class Scrape extends Collection { // query historical logs async filterTransfers(startBlock) { let transfers; - console.log(`[ ${(new Date()).toISOString()} ][ ${this.contractName} ][ scraping ] blocks ${startBlock} - ${startBlock + CHUNK_SIZE}\n`); + const timestamp = await this.getBlockTimestamp(startBlock); + console.log(`[ ${timestamp.toISOString()} ][ ${this.contractName} ][ scraping ] blocks ${startBlock} - ${startBlock + CHUNK_SIZE}\n`); if (this.erc1155) { transfers = this.contract.filters.TransferSingle(null, null); } else {