Implement transaction expiry for Overwinter

This commit is contained in:
Jay Graber
2018-02-21 20:21:06 -08:00
parent c5904fb2a4
commit 9bb37bf0d5
11 changed files with 99 additions and 10 deletions

View File

@@ -256,6 +256,24 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>
}
}
void CTxMemPool::removeExpired(unsigned int nBlockHeight)
{
// Remove expired txs from the mempool
LOCK(cs);
list<CTransaction> 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);
}
}
for (const CTransaction& tx : transactionsToRemove) {
list<CTransaction> removed;
remove(tx, removed, true);
}
}
/**
* Called when a block is connected. Removes from mempool and updates the miner fee estimator.
*/