diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 36b13918be..06623908bb 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1219,7 +1219,7 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector* pvNoSpends unsigned nTxnRemoved = 0; CFeeRate maxFeeRateRemoved(0); - while (DynamicMemoryUsage() > sizelimit) { + while (!mapTx.empty() && DynamicMemoryUsage() > sizelimit) { indexed_transaction_set::index::type::iterator it = mapTx.get().begin(); // We set the new mempool min fee to the feerate of the removed set, plus the