Don't toArray toRemove
MODIFY
WalletWasabi/Services/MemPoolService.cs
WalletWasabi/Services/MemPoolService.cs
@@ -123,11 +123,16 @@ namespace WalletWasabi.Services
var toRemove = TransactionHashes.Where(x => !allMempoolHashes.Contains(x.ToString().Substring(0, compactness)));
- foreach (uint256 tx in toRemove.ToArray())
+ int removedTxCount = 0;
+ foreach (uint256 tx in toRemove)
+ {
+ if (TransactionHashes.TryRemove(tx))
{
- TransactionHashes.TryRemove(tx);
+ removedTxCount++;
}
- Logger.LogInfo<MemPoolService>($"{toRemove.Count()} transactions were cleaned from mempool.");
+ }
+
+ Logger.LogInfo<MemPoolService>($"{removedTxCount} transactions were cleaned from mempool.");
}
return true;

Don't toArray toRemove