From cbef2ae6d0811fc7b388650d629ce9406ec0c53c Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 19 Oct 2020 17:30:47 +0700 Subject: [PATCH] Limit mempool clear protection to >20K TX mempool fixes #140 --- backend/src/api/mempool.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index 3356df7c9..2a509aa3f 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -130,7 +130,10 @@ class Mempool { } // Prevent mempool from clear on bitcoind restart by delaying the deletion - if (config.MEMPOOL.NETWORK === 'mainnet' && this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) { + if (this.mempoolProtection === 0 + && currentMempoolSize > 20000 + && transactions.length / currentMempoolSize <= 0.80 + ) { this.mempoolProtection = 1; this.inSync = false; logger.warn(`Mempool clear protection triggered because transactions.length: ${transactions.length} and currentMempoolSize: ${currentMempoolSize}.`);