Use contains
MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -386,12 +386,17 @@ namespace WalletWasabi.Services
if (tx.Height.Type == HeightType.Chain)
{
MemPool.TransactionHashes.TryRemove(txId); // If we have in mempool, remove.
- SmartTransaction foundTx = TransactionCache.FirstOrDefault(x => x == tx); // If we have in cache, update height.
- if (foundTx != default(SmartTransaction))
+
+ bool isFoundTx = TransactionCache.Contains(tx); // If we have in cache, update height.
+ if (isFoundTx)
+ {
+ SmartTransaction foundTx = TransactionCache.FirstOrDefault(x => x == tx);
+ if (foundTx != default(SmartTransaction)) // Must check again, because it's a concurrent collection!
{
foundTx.SetHeight(tx.Height);
}
}
+ }
//iterate tx
// if already have the coin

Use contains