Merge branch 'master' into regtest-1

This commit is contained in:
Antoni Spaanderman
2022-02-12 12:28:37 +01:00
committed by GitHub
13 changed files with 4533 additions and 4947 deletions

View File

@@ -303,8 +303,6 @@ class Blocks {
if (memPool.isInSync()) {
diskCache.$saveCacheToDisk();
}
return;
}
}

View File

@@ -168,7 +168,8 @@ class Mempool {
const newTransactionsStripped = newTransactions.map((tx) => Common.stripTransaction(tx));
this.latestTransactions = newTransactionsStripped.concat(this.latestTransactions).slice(0, 6);
if (!this.inSync && transactions.length === Object.keys(this.mempoolCache).length) {
const syncedThreshold = 0.99; // If we synced 99% of the mempool tx count, consider we're synced
if (!this.inSync && Object.keys(this.mempoolCache).length >= transactions.length * syncedThreshold) {
this.inSync = true;
logger.notice('The mempool is now in sync!');
loadingIndicators.setProgress('mempool', 100);

View File

@@ -46,8 +46,12 @@ class BlocksRepository {
];
await connection.query(query, params);
} catch (e) {
logger.err('$saveBlockInDatabase() error' + (e instanceof Error ? e.message : e));
} catch (e: any) {
if (e.errno === 1062) { // ER_DUP_ENTRY
logger.debug(`$saveBlockInDatabase() - Block ${block.height} has already been indexed, ignoring`);
} else {
logger.err('$saveBlockInDatabase() error' + (e instanceof Error ? e.message : e));
}
}
connection.release();