From af02e9b533ec8209e95ce6e5cd42843307e1a0ba Mon Sep 17 00:00:00 2001 From: nymkappa Date: Thu, 10 Feb 2022 19:19:54 +0900 Subject: [PATCH] Consider we're synced with the mempool if we cached 99% of pending txs --- backend/src/api/mempool.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index 4d6c35860..b1bd6a159 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -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);