Add ServiceConfiguration
MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -12,6 +12,7 @@ using WalletWasabi.Helpers;
using WalletWasabi.Interfaces;
using WalletWasabi.Logging;
using WalletWasabi.TorSocks5;
+using WalletWasabi.Models;
namespace WalletWasabi.Gui
{
@@ -46,9 +47,79 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "TorSocks5Port")]
public int? TorSocks5Port { get; internal set; }
+ [JsonProperty(PropertyName = "MixUntilAnonymitySet")]
+ public int? MixUntilAnonymitySet
+ {
+ get => _mixUntilAnonymitySet;
+ internal set
+ {
+ if (_mixUntilAnonymitySet != value)
+ {
+ _mixUntilAnonymitySet = value;
+ if (value.HasValue && ServiceConfiguration != default)
+ {
+ ServiceConfiguration.MixUntilAnonymitySet = value.Value;
+ }
+ }
+ }
+ }
+
+ [JsonProperty(PropertyName = "PrivacyLevelSome")]
+ public int? PrivacyLevelSome
+ {
+ get => _privacyLevelSome;
+ internal set
+ {
+ if (_privacyLevelSome != value)
+ {
+ _privacyLevelSome = value;
+ if (value.HasValue && ServiceConfiguration != default)
+ {
+ ServiceConfiguration.PrivacyLevelSome = value.Value;
+ }
+ }
+ }
+ }
+
+ [JsonProperty(PropertyName = "PrivacyLevelFine")]
+ public int? PrivacyLevelFine
+ {
+ get => _privacyLevelFine;
+ internal set
+ {
+ if (_privacyLevelFine != value)
+ {
+ _privacyLevelFine = value;
+ if (value.HasValue && ServiceConfiguration != default)
+ {
+ ServiceConfiguration.PrivacyLevelFine = value.Value;
+ }
+ }
+ }
+ }
+
+ [JsonProperty(PropertyName = "PrivacyLevelStrong")]
+ public int? PrivacyLevelStrong
+ {
+ get => _privacyLevelStrong;
+ internal set
+ {
+ if (_privacyLevelStrong != value)
+ {
+ _privacyLevelStrong = value;
+ if (value.HasValue && ServiceConfiguration != default)
+ {
+ ServiceConfiguration.PrivacyLevelStrong = value.Value;
+ }
+ }
+ }
+ }
+
private Uri _backendUri;
private Uri _fallbackBackendUri;
+ public ServiceConfiguration ServiceConfiguration { get; private set; }
+
public Uri GetCurrentBackendUri()
{
if (TorProcessManager.RequestFallbackAddressUsage)
@@ -95,6 +166,11 @@ namespace WalletWasabi.Gui
}
private IPEndPoint _torSocks5EndPoint;
+ private int? _mixUntilAnonymitySet;
+ private int? _privacyLevelSome;
+ private int? _privacyLevelFine;
+ private int? _privacyLevelStrong;
+ private bool? _autoMix;
public IPEndPoint GetTorSocks5EndPoint()
{
@@ -118,7 +194,22 @@ namespace WalletWasabi.Gui
SetFilePath(filePath);
}
- public Config(Network network, string mainNetBackendUriV3, string testNetBackendUriV3, string mainNetFallbackBackendUri, string testNetFallbackBackendUri, string regTestBackendUriV3, string mainNetBlindingRsaPubKey, string testNetBlindingRsaPubKey, string regTestBlindingRsaPubKey, string torHost, int? torSocks5Port)
+ public Config(
+ Network network,
+ string mainNetBackendUriV3,
+ string testNetBackendUriV3,
+ string mainNetFallbackBackendUri,
+ string testNetFallbackBackendUri,
+ string regTestBackendUriV3,
+ string mainNetBlindingRsaPubKey,
+ string testNetBlindingRsaPubKey,
+ string regTestBlindingRsaPubKey,
+ string torHost,
+ int? torSocks5Port,
+ int? mixUntilAnonymitySet,
+ int? privacyLevelSome,
+ int? privacyLevelFine,
+ int? privacyLevelStrong)
{
Network = Guard.NotNull(nameof(network), network);
@@ -131,6 +222,13 @@ namespace WalletWasabi.Gui
TorHost = Guard.NotNullOrEmptyOrWhitespace(nameof(torHost), torHost);
TorSocks5Port = Guard.NotNull(nameof(torSocks5Port), torSocks5Port);
+
+ MixUntilAnonymitySet = Guard.NotNull(nameof(mixUntilAnonymitySet), mixUntilAnonymitySet);
+ PrivacyLevelSome = Guard.NotNull(nameof(privacyLevelSome), privacyLevelSome);
+ PrivacyLevelFine = Guard.NotNull(nameof(privacyLevelFine), privacyLevelFine);
+ PrivacyLevelStrong = Guard.NotNull(nameof(privacyLevelStrong), privacyLevelStrong);
+
+ ServiceConfiguration = new ServiceConfiguration(MixUntilAnonymitySet.Value, PrivacyLevelSome.Value, PrivacyLevelFine.Value, PrivacyLevelStrong.Value);
}
/// <inheritdoc />
@@ -160,6 +258,13 @@ namespace WalletWasabi.Gui
TorHost = IPAddress.Loopback.ToString();
TorSocks5Port = 9050;
+ MixUntilAnonymitySet = 50;
+ PrivacyLevelSome = 2;
+ PrivacyLevelFine = 21;
+ PrivacyLevelStrong = 50;
+
+ ServiceConfiguration = new ServiceConfiguration(MixUntilAnonymitySet.Value, PrivacyLevelSome.Value, PrivacyLevelFine.Value, PrivacyLevelStrong.Value);
+
if (!File.Exists(FilePath))
{
Logger.LogInfo<Config>($"{nameof(Config)} file did not exist. Created at path: `{FilePath}`.");
@@ -191,6 +296,13 @@ namespace WalletWasabi.Gui
TorHost = config.TorHost ?? TorHost;
TorSocks5Port = config.TorSocks5Port ?? TorSocks5Port;
+ MixUntilAnonymitySet = config.MixUntilAnonymitySet ?? MixUntilAnonymitySet;
+ PrivacyLevelSome = config.PrivacyLevelSome ?? PrivacyLevelSome;
+ PrivacyLevelFine = config.PrivacyLevelFine ?? PrivacyLevelFine;
+ PrivacyLevelStrong = config.PrivacyLevelStrong ?? PrivacyLevelStrong;
+
+ ServiceConfiguration = config.ServiceConfiguration ?? ServiceConfiguration;
+
// Just debug convenience.
_backendUri = GetCurrentBackendUri();
}
@@ -238,12 +350,28 @@ namespace WalletWasabi.Gui
{
return true;
}
-
if (TorSocks5Port != config.TorSocks5Port)
{
return true;
}
+ if (MixUntilAnonymitySet != config.MixUntilAnonymitySet)
+ {
+ return true;
+ }
+ if (PrivacyLevelSome != config.PrivacyLevelSome)
+ {
+ return true;
+ }
+ if (PrivacyLevelFine != config.PrivacyLevelFine)
+ {
+ return true;
+ }
+ if (PrivacyLevelStrong != config.PrivacyLevelStrong)
+ {
+ return true;
+ }
+
return false;
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -31,7 +31,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private string _password;
private Money _amountQueued;
private string _warningMessage;
- private const int PreSelectMaxAnonSetExcludingCondition = 50;
private bool _isEnqueueBusy;
private bool _isDequeueBusy;
private string _enqueueButtonText;
@@ -61,7 +60,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (!(registrableRound?.State?.Denomination is null) && registrableRound.State.Denomination != Money.Zero)
{
- CoinsList = new CoinListViewModel(RequiredBTC, PreSelectMaxAnonSetExcludingCondition);
+ CoinsList = new CoinListViewModel();
}
else
{
@@ -292,7 +291,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
var available = Global.WalletService.Coins.Where(x => x.Confirmed && !x.SpentOrCoinJoinInProgress);
if (available.Any())
{
- RequiredBTC = registrableRound.State.CalculateRequiredAmount(available.Where(x => x.AnonymitySet < PreSelectMaxAnonSetExcludingCondition).Select(x => x.Amount).ToArray());
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount(available.Where(x => x.AnonymitySet < Global.Config.PrivacyLevelStrong).Select(x => x.Amount).ToArray());
}
else
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
</Grid>
<StackPanel Margin="0 10 0 0" Spacing="10" DockPanel.Dock="Bottom" Orientation="Horizontal">
<CheckBox Content = "Select All" IsThreeState="True" IsChecked = "{Binding SelectAllCheckBoxState}" Command="{Binding SelectAllCheckBoxCommand}" />
- <CheckBox Content = "Select All Private" IsThreeState="True" IsChecked = "{Binding SelectPrivateCheckBoxState}" Command="{Binding SelectPrivateCheckBoxCommand}" ToolTip.Tip="Coins with anonymity set greater than 50." />
- <CheckBox Content = "Select All Non-Private" IsThreeState="True" IsChecked = "{Binding SelectNonPrivateCheckBoxState}" Command="{Binding SelectNonPrivateCheckBoxCommand}" ToolTip.Tip="Coins with anonymity set less than 50." />
+ <CheckBox Content = "Select All Private" IsThreeState="True" IsChecked = "{Binding SelectPrivateCheckBoxState}" Command="{Binding SelectPrivateCheckBoxCommand}" ToolTip.Tip="Coins those acquired the strongest privacy shield." />
+ <CheckBox Content = "Select All Non-Private" IsThreeState="True" IsChecked = "{Binding SelectNonPrivateCheckBoxState}" Command="{Binding SelectNonPrivateCheckBoxCommand}" ToolTip.Tip="Coins those do not have the strongest privacy shield." />
</StackPanel>
<ListBox Items="{Binding Coins}" VirtualizationMode="None" SelectedItem="{Binding Path=SelectedCoin, Mode=TwoWay}">
<ListBox.ContextMenu>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -188,7 +188,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
- public CoinListViewModel(Money preSelectMinAmountIncludingCondition = null, int? preSelectMaxAnonSetExcludingCondition = null)
+ public CoinListViewModel()
{
AmountSortDirection = SortOrder.Decreasing;
RefreshOrdering();
@@ -296,15 +296,15 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
switch (SelectPrivateCheckBoxState)
{
case true:
- SelectAllCoins(true, x => x.AnonymitySet >= 50);
+ SelectAllCoins(true, x => x.AnonymitySet >= Global.Config.PrivacyLevelStrong);
break;
case false:
- SelectAllCoins(false, x => x.AnonymitySet >= 50);
+ SelectAllCoins(false, x => x.AnonymitySet >= Global.Config.PrivacyLevelStrong);
break;
case null:
- SelectAllCoins(false, x => x.AnonymitySet >= 50);
+ SelectAllCoins(false, x => x.AnonymitySet >= Global.Config.PrivacyLevelStrong);
SelectPrivateCheckBoxState = false;
break;
}
@@ -315,15 +315,15 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
switch (SelectNonPrivateCheckBoxState)
{
case true:
- SelectAllCoins(true, x => x.AnonymitySet < 50);
+ SelectAllCoins(true, x => x.AnonymitySet < Global.Config.PrivacyLevelStrong);
break;
case false:
- SelectAllCoins(false, x => x.AnonymitySet < 50);
+ SelectAllCoins(false, x => x.AnonymitySet < Global.Config.PrivacyLevelStrong);
break;
case null:
- SelectAllCoins(false, x => x.AnonymitySet < 50);
+ SelectAllCoins(false, x => x.AnonymitySet < Global.Config.PrivacyLevelStrong);
SelectNonPrivateCheckBoxState = false;
break;
}
@@ -366,8 +366,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private void SetSelections()
{
SelectAllCheckBoxState = GetCheckBoxesSelectedState(x => true);
- SelectPrivateCheckBoxState = GetCheckBoxesSelectedState(x => x.AnonymitySet >= 50);
- SelectNonPrivateCheckBoxState = GetCheckBoxesSelectedState(x => x.AnonymitySet < 50);
+ SelectPrivateCheckBoxState = GetCheckBoxesSelectedState(x => x.AnonymitySet >= Global.Config.PrivacyLevelStrong);
+ SelectNonPrivateCheckBoxState = GetCheckBoxesSelectedState(x => x.AnonymitySet < Global.Config.PrivacyLevelStrong);
}
private void SetCoinJoinStatusWidth()

MODIFY
WalletWasabi.Gui/Converters/PrivacyLevelValueConverter.cs
WalletWasabi.Gui/Converters/PrivacyLevelValueConverter.cs
@@ -37,15 +37,15 @@ namespace WalletWasabi.Gui.Converters
if (value is int integer)
{
var shield = string.Empty;
- if (integer <= 1)
+ if (integer < Global.Config.PrivacyLevelSome)
{
shield = "Critical";
}
- else if (integer < 21)
+ else if (integer < Global.Config.PrivacyLevelFine)
{
shield = "Some";
}
- else if (integer < 50)
+ else if (integer < Global.Config.PrivacyLevelStrong)
{
shield = "Fine";
}

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -248,7 +248,7 @@ namespace WalletWasabi.Gui
public static async Task InitializeWalletServiceAsync(KeyManager keyManager)
{
ChaumianClient = new CcjClient(Synchronizer, Network, keyManager, Config.GetCurrentBackendUri(), Config.GetTorSocks5EndPoint());
- WalletService = new WalletService(keyManager, Synchronizer, ChaumianClient, MemPoolService, Nodes, DataDir);
+ WalletService = new WalletService(keyManager, Synchronizer, ChaumianClient, MemPoolService, Nodes, DataDir, Config.ServiceConfiguration);
ChaumianClient.Start();
Logger.LogInfo("Start Chaumian CoinJoin service...");

MODIFY
WalletWasabi.Tests/P2pTests.cs
WalletWasabi.Tests/P2pTests.cs
@@ -90,7 +90,8 @@ namespace WalletWasabi.Tests
new CcjClient(syncer, network, keyManager, new Uri("http://localhost:12345")),
memPoolService,
nodes,
- SharedFixture.DataDir);
+ SharedFixture.DataDir,
+ new ServiceConfiguration(false, 50, 2, 21, 50));
Assert.True(Directory.Exists(blocksFolderPath));
try

MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -71,7 +71,7 @@ namespace WalletWasabi.Tests
}
}
- private async Task<(string password, RPCClient rpc, Network network, CcjCoordinator coordinator)> InitializeTestEnvironmentAsync(int numberOfBlocksToGenerate)
+ private async Task<(string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration)> InitializeTestEnvironmentAsync(int numberOfBlocksToGenerate)
{
await AssertFiltersInitializedAsync(); // Make sure fitlers are created on the server side.
if (numberOfBlocksToGenerate != 0)
@@ -79,7 +79,9 @@ namespace WalletWasabi.Tests
await Global.RpcClient.GenerateAsync(numberOfBlocksToGenerate); // Make sure everything is confirmed.
}
Global.Coordinator.UtxoReferee.Clear();
- return ("password", Global.RpcClient, Global.RpcClient.Network, Global.Coordinator);
+
+ var serviceConfiguration = new ServiceConfiguration(false, 50, 2, 21, 50);
+ return ("password", Global.RpcClient, Global.RpcClient.Network, Global.Coordinator, serviceConfiguration);
}
#region BackendTests
@@ -115,7 +117,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task BroadcastReplayTxAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var utxos = await rpc.ListUnspentAsync();
var utxo = utxos[0];
@@ -135,7 +137,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task BroadcastInvalidTxAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var content = new StringContent($"''", Encoding.UTF8, "application/json");
@@ -153,7 +155,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task FilterBuilderTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var indexBuilderServiceDir = Path.Combine(SharedFixture.DataDir, nameof(IndexBuilderService));
var indexFilePath = Path.Combine(indexBuilderServiceDir, $"Index{rpc.Network}.dat");
@@ -222,7 +224,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task AllFeeEstimateRpcAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var estimations = await rpc.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, tolerateBitcoinCoreBrainfuck: true);
Assert.Equal(144, estimations.Estimations.Count);
@@ -248,7 +250,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task MempoolAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var memPoolService = new MemPoolService();
Node node = RegTestFixture.BackendRegTestNode.CreateNodeClient();
@@ -296,7 +298,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task FilterDownloaderTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var indexFilePath = Path.Combine(SharedFixture.DataDir, nameof(FilterDownloaderTestAsync), $"Index{rpc.Network}.dat");
@@ -351,7 +353,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task ReorgTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var keyManager = KeyManager.CreateNew(out _, password);
@@ -485,7 +487,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task WalletTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
// Create the services.
// 1. Create connection service.
@@ -510,7 +512,7 @@ namespace WalletWasabi.Tests
// 5. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(WalletTestsAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
// Get some money, make it confirm.
@@ -715,7 +717,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task SendTestsFromHiddenWalletAsync() // These tests are taken from HiddenWallet, they were tests on the testnet.
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
// Create the services.
// 1. Create connection service.
@@ -739,7 +741,7 @@ namespace WalletWasabi.Tests
// 6. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
// Get some money, make it confirm.
@@ -1159,7 +1161,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task BuildTransactionValidationsTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
// Create the services.
// 1. Create connection service.
@@ -1183,7 +1185,7 @@ namespace WalletWasabi.Tests
// 6. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
var scp = new Key().ScriptPubKey;
@@ -1323,7 +1325,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task BuildTransactionReorgsTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
// Create the services.
// 1. Create connection service.
@@ -1347,7 +1349,7 @@ namespace WalletWasabi.Tests
// 6. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
Assert.Empty(wallet.Coins);
@@ -1488,7 +1490,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task SpendUnconfirmedTxTestAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
// Create the services.
// 1. Create connection service.
@@ -1514,7 +1516,7 @@ namespace WalletWasabi.Tests
// 6. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
Assert.Empty(wallet.Coins);
@@ -1650,7 +1652,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task CcjCoordinatorCtorTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Logger.TurnOff(); // turn off at the end, otherwise, the tests logs would have of warnings
@@ -1700,7 +1702,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task CcjTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Money denomination = Money.Coins(0.2m);
decimal coordinatorFeePercent = 0.2m;
@@ -2187,7 +2189,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task CcjEqualInputTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Money denomination = Money.Coins(0.1m);
decimal coordinatorFeePercent = 0.0002m;
@@ -2344,7 +2346,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task NotingTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Money denomination = Money.Coins(1m);
decimal coordinatorFeePercent = 0.1m;
@@ -2422,7 +2424,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task BanningTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Money denomination = Money.Coins(0.1m);
decimal coordinatorFeePercent = 0.1m;
@@ -2629,7 +2631,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task Ccj100ParticipantsTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
Money denomination = Money.Coins(0.1m);
decimal coordinatorFeePercent = 0.003m;
@@ -2838,7 +2840,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task CcjClientTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(1);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(1);
var indexFilePath = Path.Combine(SharedFixture.DataDir, nameof(CcjClientTestsAsync), $"Index{network}.dat");
var synchronizer = new WasabiSynchronizer(network, indexFilePath, new Uri(RegTestFixture.BackendEndPoint));
@@ -2995,7 +2997,7 @@ namespace WalletWasabi.Tests
[Fact]
public async Task CoinJoinMultipleRoundTestsAsync()
{
- (string password, RPCClient rpc, Network network, CcjCoordinator coordinator) = await InitializeTestEnvironmentAsync(3);
+ (string password, RPCClient rpc, Network network, CcjCoordinator coordinator, ServiceConfiguration serviceConfiguration) = await InitializeTestEnvironmentAsync(3);
Money denomination = Money.Coins(0.1m);
decimal coordinatorFeePercent = 0.1m;
@@ -3041,11 +3043,11 @@ namespace WalletWasabi.Tests
// 6. Create wallet service.
var workDir = Path.Combine(SharedFixture.DataDir, nameof(CoinJoinMultipleRoundTestsAsync));
- var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir);
+ var wallet = new WalletService(keyManager, synchronizer, chaumianClient, memPoolService, nodes, workDir, serviceConfiguration);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
var workDir2 = Path.Combine(SharedFixture.DataDir, $"{nameof(CoinJoinMultipleRoundTestsAsync)}2");
- var wallet2 = new WalletService(keyManager2, synchronizer2, chaumianClient2, memPoolService2, nodes2, workDir2);
+ var wallet2 = new WalletService(keyManager2, synchronizer2, chaumianClient2, memPoolService2, nodes2, workDir2, serviceConfiguration);
// Get some money, make it confirm.
var key = wallet.GetReceiveKey("fundZeroLink");

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -47,6 +47,8 @@ namespace WalletWasabi.Services
/// </summary>
public static event EventHandler<int> ConcurrentBlockDownloadNumberChanged;
+ public ServiceConfiguration ServiceConfiguration { get; }
+
public SortedDictionary<Height, uint256> WalletBlocks { get; }
public ConcurrentDictionary<uint256, (Height height, DateTimeOffset dateTime)> ProcessedBlocks { get; }
private AsyncLock WalletBlocksLock { get; }
@@ -71,13 +73,21 @@ namespace WalletWasabi.Services
public bool IsRunning => Interlocked.Read(ref _running) == 1;
public bool IsStopping => Interlocked.Read(ref _running) == 2;
- public WalletService(KeyManager keyManager, WasabiSynchronizer syncer, CcjClient chaumianClient, MemPoolService memPool, NodesGroup nodes, string workFolderDir)
+ public WalletService(
+ KeyManager keyManager,
+ WasabiSynchronizer syncer,
+ CcjClient chaumianClient,
+ MemPoolService memPool,
+ NodesGroup nodes,
+ string workFolderDir,
+ ServiceConfiguration serviceConfiguration)
{
KeyManager = Guard.NotNull(nameof(keyManager), keyManager);
Nodes = Guard.NotNull(nameof(nodes), nodes);
Synchronizer = Guard.NotNull(nameof(syncer), syncer);
ChaumianClient = Guard.NotNull(nameof(chaumianClient), chaumianClient);
MemPool = Guard.NotNull(nameof(memPool), memPool);
+ ServiceConfiguration = Guard.NotNull(nameof(serviceConfiguration), serviceConfiguration);
WalletBlocks = new SortedDictionary<Height, uint256>();
ProcessedBlocks = new ConcurrentDictionary<uint256, (Height height, DateTimeOffset dateTime)>();
@@ -334,7 +344,7 @@ namespace WalletWasabi.Services
}
// If it spends someone and haven't been sufficiently anonimized.
- if (coin.AnonymitySet < 50)
+ if (coin.AnonymitySet < ServiceConfiguration.PrivacyLevelStrong)
{
var c = Coins.FirstOrDefault(x => x.SpenderTransactionId == coin.TransactionId && !history.Contains(x));
if (c != default)
@@ -356,7 +366,7 @@ namespace WalletWasabi.Services
var c = Coins.FirstOrDefault(x => x.TransactionId == coin.SpenderTransactionId && !history.Contains(x));
if (c != default)
{
- if (c.AnonymitySet < 50)
+ if (c.AnonymitySet < ServiceConfiguration.PrivacyLevelStrong)
{
if (c != default)
{

Add ServiceConfiguration