Fix block indexing log

This commit is contained in:
nymkappa 2022-03-10 14:23:29 +01:00
parent 8ca3f6e72b
commit 9a71c15b49
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -218,6 +218,7 @@ class Blocks {
break;
}
++indexedThisRun;
++totaIndexed;
const elapsedSeconds = Math.max(1, Math.round((new Date().getTime() / 1000) - timer));
if (elapsedSeconds > 5 || blockHeight === lastBlockToIndex) {
const runningFor = Math.max(1, Math.round((new Date().getTime() / 1000) - startedAt));
@ -227,7 +228,7 @@ class Blocks {
logger.debug(`Indexing block #${blockHeight} | ~${blockPerSeconds} blocks/sec | total: ${totaIndexed}/${indexingBlockAmount} (${progress}%) | elapsed: ${runningFor} seconds | left: ~${timeLeft} seconds`);
timer = new Date().getTime() / 1000;
indexedThisRun = 0;
}
}
const blockHash = await bitcoinApi.$getBlockHash(blockHeight);
const block = await bitcoinApi.$getBlock(blockHash);
const transactions = await this.$getTransactionsExtended(blockHash, block.height, true, true);