Make sure to re-index skipped block when backend is offline for too long

This commit is contained in:
nymkappa 2022-05-12 10:12:14 +02:00
parent ae13f6119e
commit 7f8696c88d
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -201,13 +201,12 @@ class Blocks {
return;
}
this.reindexFlag = false;
const blockchainInfo = await bitcoinClient.getBlockchainInfo();
if (blockchainInfo.blocks !== blockchainInfo.headers) { // Wait for node to sync
return;
}
this.reindexFlag = false;
this.blockIndexingStarted = true;
this.blockIndexingCompleted = false;
@ -299,6 +298,7 @@ class Blocks {
logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${config.MEMPOOL.INITIAL_BLOCKS_AMOUNT} recent blocks`);
this.currentBlockHeight = blockHeightTip - config.MEMPOOL.INITIAL_BLOCKS_AMOUNT;
fastForwarded = true;
this.reindexFlag = true; // Make sure to index the skipped blocks #1619
}
if (!this.lastDifficultyAdjustmentTime) {