Merge pull request #1240 from nymkappa/feature/mempool-sync-threshold

Consider we're synced with the mempool if we cached 99% of pending txs
This commit is contained in:
softsimon 2022-02-10 16:28:13 +04:00 committed by GitHub
commit 2f921f4cc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);