Assert anonymity set.
MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -2193,7 +2193,7 @@ namespace WalletWasabi.Tests
var coordinator = Global.Coordinator;
Money denomination = new Money(0.1m, MoneyUnit.BTC);
decimal coordinatorFeePercent = 0.1m;
- int anonymitySet = 100;
+ int anonymitySet = 10;
int connectionConfirmationTimeout = 120;
var roundConfig = new CcjRoundConfig(denomination, 140, coordinatorFeePercent, anonymitySet, 240, connectionConfirmationTimeout, 50, 50, 1);
coordinator.UpdateRoundConfig(roundConfig);
@@ -2408,6 +2408,10 @@ namespace WalletWasabi.Tests
Assert.True(feeRateReal.FeePerK < feeRateTx.FeePerK);
Assert.True(2 * feeRateReal.FeePerK > feeRateTx.FeePerK); // Max 200% mistake.
+
+ var activeOutput = finalCoinjoin.GetIndistinguishableOutputs().OrderByDescending(x=>x.count).First();
+ Assert.True(activeOutput.value >= roundConfig.Denomination);
+ Assert.True(activeOutput.value >= roundConfig.AnonymitySet);
}
}

MODIFY
WalletWasabi/ChaumianCoinJoin/CcjRound.cs
WalletWasabi/ChaumianCoinJoin/CcjRound.cs
@@ -653,6 +653,10 @@ namespace WalletWasabi.ChaumianCoinJoin
Logger.LogInfo<CcjRound>($"Round ({RoundId}): Number of outputs: {SignedCoinJoin.Outputs.Count}.");
Logger.LogInfo<CcjRound>($"Round ({RoundId}): Serialized Size: {SignedCoinJoin.GetSerializedSize()/1024} KB.");
Logger.LogInfo<CcjRound>($"Round ({RoundId}): VSize: {SignedCoinJoin.GetVirtualSize()/1024} KB.");
+ foreach(var o in SignedCoinJoin.GetIndistinguishableOutputs().Where(x=>x.count > 1))
+ {
+ Logger.LogInfo<CcjRound>($"Round ({RoundId}): There are {o.count} occurences of {o.value.ToString(true, false)} BTC output.");
+ }
await RpcClient.SendRawTransactionAsync(SignedCoinJoin);
Succeed(syncLock: false);

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -2,6 +2,7 @@ using WalletWasabi.Models;
using System.Collections.Generic;
using System;
using WalletWasabi.Helpers;
+using System.Linq;
namespace NBitcoin
{
@@ -35,5 +36,16 @@ namespace NBitcoin
Guard.NotNullOrEmptyOrWhitespace(nameof(hex), hex);
me.FromBytes(ByteHelpers.FromHex(hex));
}
+
+ public static IEnumerable<(Money value, int count)> GetIndistinguishableOutputs(this Transaction me)
+ {
+ var ret = new List<(Money Value, int count)>();
+ foreach (Money v in me.Outputs.Select(x => x.Value).Distinct())
+ {
+ ret.Add((v, me.Outputs.Count(x => x.Value == v)));
+ }
+
+ return ret;
+ }
}
}
\ No newline at end of file

Assert anonymity set.