Optimize coinjoin coin selection:
If only one input is to be registered, try to register with the smallest anonymity set, so new unmixed coins come to the mix.
Else try to register the largest anonymity set, so red and green coins input merging should be less likely.
MODIFY
WalletWasabi/Models/ChaumianCoinJoin/CcjClientState.cs
WalletWasabi/Models/ChaumianCoinJoin/CcjClientState.cs
@@ -196,16 +196,23 @@ namespace WalletWasabi.Models.ChaumianCoinJoin
var linq = coins.GetPermutations(i);
linq = linq.Where(x => x.Sum(y => y.Amount) >= amountNeededExceptInputFees + (feePerInputs * i)); // If the sum reaches the minimum amount.
- if (i == 1) // If only one input is to be registered, prefer the largest one, so more mixing volume is more likely.
+ if (i == 1)
{
+ // If only one input is to be registered, prefer the largest one, so more mixing volume is more likely.
linq = linq.OrderByDescending(x => x.Sum(y => y.Amount));
+
+ // If only one input is to be registered, try to register with the smallest anonymity set, so new unmixed coins come to the mix.
+ linq = linq.OrderBy(x => x.Sum(y => y.AnonymitySet));
}
- else // Else prefer the lowest amount sum, so perfect mix should be more likely.
+ else
{
- linq = linq.OrderBy(x => x.Sum(y => y.Amount)); // Then the lowest amount, so perfect mix should be more likely.
+ // Else prefer the lowest amount sum, so perfect mix should be more likely.
+ linq = linq.OrderBy(x => x.Sum(y => y.Amount));
+
+ // Else try to register the largest anonymity set, so red and green coins input merging should be less likely.
+ linq = linq.OrderByDescending(x => x.Sum(y => y.AnonymitySet));
}
- linq = linq.OrderBy(x => x.Sum(y => y.AnonymitySet)); // First try t register with the smallest anonymity set.
linq = linq.OrderBy(x => x.Count(y => y.Confirmed == false)); // Where the lowest amount of unconfirmed coins there are.
IEnumerable<SmartCoin> best = linq.FirstOrDefault();

Optimize coinjoin coin selection:
If only one input is to be registered, try to register with the smallest anonymity set, so new unmixed coins come to the mix.
Else try to register the largest anonymity set, so red and green coins input merging should be less likely.