From dd20bebc5cfa01a1a867162a74cc4837060ade2a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Apr 2018 15:40:31 +0300 Subject: [PATCH] Add interest based expiration to CTxMemPool::removeExpired MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix will remove from the mempool tx that wouldn’t current be accepted into the mempool. Useful when some old mempool entries keep getting restored. --- src/txmempool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 2dc9a4642..255bdb10a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -261,15 +261,20 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list } } +int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag); + void CTxMemPool::removeExpired(unsigned int nBlockHeight) { + CBlockIndex *tipindex; // Remove expired txs from the mempool LOCK(cs); list transactionsToRemove; for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { const CTransaction& tx = it->GetTx(); - if (IsExpiredTx(tx, nBlockHeight)) { + tipindex = chainActive.Tip(); + if (IsExpiredTx(tx, nBlockHeight) || (tipindex != 0 && komodo_validate_interest(tx,tipindex->nHeight+1,tipindex->GetMedianTimePast() + 777,1)) < 0) + { transactionsToRemove.push_back(tx); } } @@ -280,6 +285,7 @@ void CTxMemPool::removeExpired(unsigned int nBlockHeight) } } + /** * Called when a block is connected. Removes from mempool and updates the miner fee estimator. */