Abort processing dust coins early
MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -633,6 +633,11 @@ namespace WalletWasabi.Services
walletRelevant = true;
foundKey.SetKeyState(KeyState.Used, KeyManager);
+ if (output.Value <= ServiceConfiguration.DustThreshold)
+ {
+ continue;
+ }
+
spentOwnCoins = spentOwnCoins ?? Coins.Where(x => tx.Transaction.Inputs.Any(y => y.PrevOut.Hash == x.TransactionId && y.PrevOut.N == x.Index)).ToList();
var anonset = tx.Transaction.GetAnonymitySet(i);
if (spentOwnCoins.Count != 0)
@@ -640,11 +645,6 @@ namespace WalletWasabi.Services
anonset += spentOwnCoins.Min(x => x.AnonymitySet) - 1; // Minus 1, because do not count own.
}
- if (output.Value <= ServiceConfiguration.DustThreshold)
- {
- continue;
- }
-
SmartCoin newCoin = new SmartCoin(txId, i, output.ScriptPubKey, output.Value, tx.Transaction.Inputs.ToTxoRefs().ToArray(), tx.Height, tx.IsRBF, anonset, foundKey.Label, spenderTransactionId: null, false, pubKey: foundKey); // Do not inherit locked status from key, that's different.
// If we did not have it.
if (Coins.TryAdd(newCoin))

Abort processing dust coins early