diff --git a/src/txmempool.cpp b/src/txmempool.cpp index fb473158c..53b971809 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -469,10 +469,17 @@ extern char SMART_CHAIN_SYMBOL[]; std::vector CTxMemPool::removeExpired(unsigned int nBlockHeight) { - CBlockIndex *tipindex; - // Remove expired txs from the mempool + // Remove expired txs from the mempool. (Regression fix: the scan that populates + // transactionsToRemove had been dropped, making this a no-op, so expired txs -- which + // can never be mined -- were never evicted and accumulated without bound.) 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)) { + transactionsToRemove.push_back(tx); + } + } std::vector ids; for (const CTransaction& tx : transactionsToRemove) {