Limit mempool clear protection to >20K TX mempool

fixes #140
This commit is contained in:
softsimon 2020-10-19 17:30:47 +07:00
parent 45efb604c1
commit cbef2ae6d0
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -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}.`);