Add MinAnonScoreTarget as parameter
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Participant.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Participant.cs
@@ -89,7 +89,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
var kitchen = new Kitchen();
kitchen.Cook("");
- var coinJoinClient = new CoinJoinClient(HttpClientFactory, kitchen, KeyManager, roundStateUpdater);
+ var coinJoinClient = new CoinJoinClient(HttpClientFactory, kitchen, KeyManager, roundStateUpdater, consolidationMode: true);
// Run the coinjoin client task.
await coinJoinClient.StartCoinJoinAsync(Coins, cancellationToken).ConfigureAwait(false);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -127,7 +127,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
var kitchen = new Kitchen();
kitchen.Cook("");
- var coinJoinClient = new CoinJoinClient(mockHttpClientFactory.Object, kitchen, keyManager, roundStateUpdater);
+ var coinJoinClient = new CoinJoinClient(mockHttpClientFactory.Object, kitchen, keyManager, roundStateUpdater, consolidationMode: true);
// Run the coinjoin client task.
Assert.True(await coinJoinClient.StartCoinJoinAsync(coins, cts.Token));
@@ -223,7 +223,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
var kitchen = new Kitchen();
kitchen.Cook("");
- var coinJoinClient = new CoinJoinClient(mockHttpClientFactory.Object, kitchen, keyManager1, roundStateUpdater);
+ var coinJoinClient = new CoinJoinClient(mockHttpClientFactory.Object, kitchen, keyManager1, roundStateUpdater, consolidationMode: true);
// Run the coinjoin client task.
var coinJoinTask = Task.Run(async () => await coinJoinClient.StartCoinJoinAsync(coins, cts.Token).ConfigureAwait(false), cts.Token);
@@ -245,7 +245,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
.Setup(factory => factory.NewBackendHttpClient(It.IsAny<Mode>()))
.Returns(nonSigningHttpClient.Object);
- var badCoinJoinClient = new CoinJoinClient(mockNonSigningHttpClientFactory.Object, kitchen, keyManager2, roundStateUpdater);
+ var badCoinJoinClient = new CoinJoinClient(mockNonSigningHttpClientFactory.Object, kitchen, keyManager2, roundStateUpdater, consolidationMode: true);
var badCoinsTask = Task.Run(async () => await badCoinJoinClient.StartRoundAsync(badCoins, roundState, cts.Token).ConfigureAwait(false), cts.Token);
await Task.WhenAll(new Task[] { badCoinsTask, coinJoinTask });

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
@@ -30,12 +30,16 @@ namespace WalletWasabi.WabiSabi.Client
IBackendHttpClientFactory httpClientFactory,
Kitchen kitchen,
KeyManager keymanager,
- RoundStateUpdater roundStatusUpdater)
+ RoundStateUpdater roundStatusUpdater,
+ int minAnonScoreTarget = int.MaxValue,
+ bool consolidationMode = false)
{
HttpClientFactory = httpClientFactory;
Kitchen = kitchen;
Keymanager = keymanager;
RoundStatusUpdater = roundStatusUpdater;
+ MinAnonScoreTarget = minAnonScoreTarget;
+ ConsolidationMode = consolidationMode;
SecureRandom = new SecureRandom();
}
@@ -44,6 +48,7 @@ namespace WalletWasabi.WabiSabi.Client
public Kitchen Kitchen { get; }
public KeyManager Keymanager { get; }
private RoundStateUpdater RoundStatusUpdater { get; }
+ public int MinAnonScoreTarget { get; }
public bool InCriticalCoinJoinState
{
@@ -51,6 +56,8 @@ namespace WalletWasabi.WabiSabi.Client
private set => _inCriticalCoinJoinState = value;
}
+ public bool ConsolidationMode { get; private set; }
+
public async Task<bool> StartCoinJoinAsync(IEnumerable<SmartCoin> coins, CancellationToken cancellationToken)
{
var currentRoundState = await RoundStatusUpdater.CreateRoundAwaiter(roundState => roundState.Phase == Phase.InputRegistration, cancellationToken).ConfigureAwait(false);
@@ -310,13 +317,13 @@ namespace WalletWasabi.WabiSabi.Client
.ToArray();
// How many inputs do we want to provide to the mix?
- int inputCount = GetInputTarget(filteredCoins.Length);
+ int inputCount = ConsolidationMode ? MaxInputsRegistrableByWallet : GetInputTarget(filteredCoins.Length);
// Select a group of coins those are close to each other by Anonimity Score.
List<IEnumerable<SmartCoin>> groups = new();
// I can take more coins those are already reached the minimum privacy threshold.
- int nonPrivateCoinCount = filteredCoins.Where(x => x.HdPubKey.AnonymitySet < 5).Count();
+ int nonPrivateCoinCount = filteredCoins.Where(x => x.HdPubKey.AnonymitySet < MinAnonScoreTarget).Count();
for (int i = 0; i < nonPrivateCoinCount; i++)
{
var group = filteredCoins.Skip(i).Take(inputCount);

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -76,7 +76,7 @@ namespace WalletWasabi.WabiSabi.Client
continue;
}
- var coinjoinClient = new CoinJoinClient(HttpClientFactory, openedWallet.Kitchen, openedWallet.KeyManager, RoundStatusUpdater);
+ var coinjoinClient = new CoinJoinClient(HttpClientFactory, openedWallet.Kitchen, openedWallet.KeyManager, RoundStatusUpdater, openedWallet.ServiceConfiguration.MinAnonScoreTarget);
var cts = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken);
var coinjoinTask = coinjoinClient.StartCoinJoinAsync(coinCandidates, cts.Token);

Add MinAnonScoreTarget as parameter