Fix CF + P2pTests
MODIFY
WalletWasabi.Fluent/Global.cs
WalletWasabi.Fluent/Global.cs
@@ -36,39 +36,8 @@ namespace WalletWasabi.Fluent;
public class Global
{
- public const string ThemeBackgroundBrushResourceKey = "ThemeBackgroundBrush";
- public const string ApplicationAccentForegroundBrushResourceKey = "ApplicationAccentForegroundBrush";
-
- public string DataDir { get; }
- public TorSettings TorSettings { get; }
- public BitcoinStore BitcoinStore { get; }
-
- /// <summary>HTTP client factory for sending HTTP requests.</summary>
- public HttpClientFactory HttpClientFactory { get; }
- public HttpClientFactory CoordinatorHttpClientFactory { get; }
-
- public LegalChecker LegalChecker { get; private set; }
- public Config Config { get; }
- public WasabiSynchronizer Synchronizer { get; private set; }
- public WalletManager WalletManager { get; }
- public TransactionBroadcaster TransactionBroadcaster { get; set; }
- public CoinJoinProcessor? CoinJoinProcessor { get; set; }
- private TorProcessManager? TorManager { get; set; }
- public CoreNode? BitcoinCoreNode { get; private set; }
- public TorStatusChecker TorStatusChecker { get; set; }
- public UpdateManager UpdateManager { get; set; }
- public HostedServices HostedServices { get; }
-
- public UiConfig UiConfig { get; }
-
- public Network Network => Config.Network;
-
- public MemoryCache Cache { get; private set; }
-
- public JsonRpcServer? RpcServer { get; private set; }
- private PersonCircuit RoundStateUpdaterCircuit { get; }
- private AllTransactionStore AllTransactionStore { get; }
- private IndexStore IndexStore { get; }
+ /// <remarks>Use this variable as a guard to prevent touching <see cref="StoppingCts"/> that might have already been disposed.</remarks>
+ private volatile bool _disposeRequested;
public Global(string dataDir, Config config, UiConfig uiConfig, WalletManager walletManager)
{
@@ -105,13 +74,8 @@ public class Global
});
}
- private HttpClientFactory BuildHttpClientFactory(Func<Uri> backendUriGetter) =>
- new (
- Config.UseTor ? TorSettings.SocksEndpoint : null,
- backendUriGetter);
-
- /// <remarks>Use this variable as a guard to prevent touching <see cref="StoppingCts"/> that might have already been disposed.</remarks>
- private volatile bool _disposeRequested;
+ public const string ThemeBackgroundBrushResourceKey = "ThemeBackgroundBrush";
+ public const string ApplicationAccentForegroundBrushResourceKey = "ApplicationAccentForegroundBrush";
/// <summary>Lock that makes sure the application initialization and dispose methods do not run concurrently.</summary>
private AsyncLock InitializationAsyncLock { get; } = new();
@@ -119,6 +83,42 @@ public class Global
/// <summary>Cancellation token to cancel <see cref="InitializeNoWalletAsync(TerminateService)"/> processing.</summary>
private CancellationTokenSource StoppingCts { get; } = new();
+ public string DataDir { get; }
+ public TorSettings TorSettings { get; }
+ public BitcoinStore BitcoinStore { get; }
+
+ /// <summary>HTTP client factory for sending HTTP requests.</summary>
+ public HttpClientFactory HttpClientFactory { get; }
+ public HttpClientFactory CoordinatorHttpClientFactory { get; }
+
+ public LegalChecker LegalChecker { get; private set; }
+ public Config Config { get; }
+ public WasabiSynchronizer Synchronizer { get; private set; }
+ public WalletManager WalletManager { get; }
+ public TransactionBroadcaster TransactionBroadcaster { get; set; }
+ public CoinJoinProcessor? CoinJoinProcessor { get; set; }
+ private TorProcessManager? TorManager { get; set; }
+ public CoreNode? BitcoinCoreNode { get; private set; }
+ public TorStatusChecker TorStatusChecker { get; set; }
+ public UpdateManager UpdateManager { get; set; }
+ public HostedServices HostedServices { get; }
+
+ public UiConfig UiConfig { get; }
+
+ public Network Network => Config.Network;
+
+ public MemoryCache Cache { get; private set; }
+
+ public JsonRpcServer? RpcServer { get; private set; }
+ private PersonCircuit RoundStateUpdaterCircuit { get; }
+ private AllTransactionStore AllTransactionStore { get; }
+ private IndexStore IndexStore { get; }
+
+ private HttpClientFactory BuildHttpClientFactory(Func<Uri> backendUriGetter) =>
+ new (
+ Config.UseTor ? TorSettings.SocksEndpoint : null,
+ backendUriGetter);
+
public async Task InitializeNoWalletAsync(TerminateService terminateService)
{
// StoppingCts may be disposed at this point, so do not forward the cancellation token here.

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Tests.IntegrationTests;
public class P2pTests
{
[Theory]
- // [InlineData("test")] - ToDo, this test fails for some reason.
+ [InlineData("test")]
[InlineData("main")]
public async Task TestServicesAsync(string networkString)
{
@@ -111,7 +111,6 @@ public class P2pTests
IRepository<uint256, Block> blockRepository = bitcoinStore.BlockRepository;
IBlockProvider blockProvider = new SmartBlockProvider(
blockRepository,
-
new RpcBlockProvider(null),
new SpecificNodeBlockProvider(network, serviceConfig, httpClientFactory),
new P2PBlockProvider(network, nodes, httpClientFactory),
@@ -159,7 +158,7 @@ public class P2pTests
i++;
}
- await mempoolTransactionAwaiter.WaitAsync(TimeSpan.FromMinutes(1));
+ await mempoolTransactionAwaiter.WaitAsync(TimeSpan.FromMinutes(3));
}
finally
{

MODIFY
WalletWasabi.Tests/UnitTests/SmartBlockProviderTests.cs
WalletWasabi.Tests/UnitTests/SmartBlockProviderTests.cs
@@ -67,7 +67,7 @@ public class SmartBlockProviderTests
Assert.NotSame(blocks[0], result[1]);
}
- public class TestBlockProvider : IBlockProvider
+ private class TestBlockProvider : IBlockProvider
{
public TestBlockProvider(Dictionary<uint256, Block> blocks)
{

MODIFY
WalletWasabi/Wallets/RpcBlockProvider.cs
WalletWasabi/Wallets/RpcBlockProvider.cs
@@ -8,13 +8,13 @@ namespace WalletWasabi.Wallets;
public class RpcBlockProvider : IBlockProvider
{
- private CoreNode? CoreNode { get; }
-
public RpcBlockProvider(CoreNode? coreNode)
{
CoreNode = coreNode;
}
+ private CoreNode? CoreNode { get; }
+
public async Task<Block?> TryGetBlockAsync(uint256 hash, CancellationToken cancellationToken)
{
if (CoreNode?.RpcClient is null)

MODIFY
WalletWasabi/Wallets/SpecificNodeBlockProvider.cs
WalletWasabi/Wallets/SpecificNodeBlockProvider.cs
@@ -15,7 +15,6 @@ namespace WalletWasabi.Wallets;
public class SpecificNodeBlockProvider : IBlockProvider
{
-
// This provider uses <Network>BitcoinP2pEndPoint from Config to provide blocks from a local or remote node.
public SpecificNodeBlockProvider(Network network, ServiceConfiguration serviceConfiguration, HttpClientFactory httpClientFactory)
{
@@ -79,6 +78,7 @@ public class SpecificNodeBlockProvider : IBlockProvider
// Get block from specific node.
Block blockFromSpecificNode;
+
// Should timeout faster. Not sure if it should ever fail though. Maybe let's keep like this later for remote node connection.
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(64)))
{

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
@@ -85,6 +85,34 @@ public class Wallet : BackgroundService, IWallet
public bool RedCoinIsolation => KeyManager.RedCoinIsolation;
+ public Network Network { get; }
+ public TransactionProcessor TransactionProcessor { get; private set; }
+
+ public HybridFeeProvider FeeProvider { get; private set; }
+ public FilterModel LastProcessedFilter { get; private set; }
+ public IBlockProvider BlockProvider { get; private set; }
+ private AsyncLock HandleFiltersLock { get; }
+
+ public bool IsLoggedIn { get; private set; }
+
+ public Kitchen Kitchen { get; } = new();
+
+ public IKeyChain? KeyChain { get; }
+
+ public IDestinationProvider DestinationProvider { get; }
+
+ public int AnonScoreTarget => KeyManager.AnonScoreTarget;
+ public bool ConsolidationMode => false;
+
+ public bool IsMixable =>
+ State == WalletState.Started // Only running wallets
+ && !KeyManager.IsWatchOnly // that are not watch-only wallets
+ && Kitchen.HasIngredients;
+
+ public TimeSpan FeeRateMedianTimeFrame => TimeSpan.FromHours(KeyManager.FeeRateMedianTimeFrameHours);
+
+ public bool IsUnderPlebStop => Coins.TotalAmount() <= KeyManager.PlebStopThreshold;
+
public Task<bool> IsWalletPrivateAsync() => Task.FromResult(IsWalletPrivate());
public bool IsWalletPrivate() => GetPrivacyPercentage(new CoinsView(Coins), AnonScoreTarget) >= 1;
@@ -93,6 +121,8 @@ public class Wallet : BackgroundService, IWallet
public Task<IEnumerable<SmartTransaction>> GetTransactionsAsync() => Task.FromResult(GetTransactions());
+ public IEnumerable<SmartCoin> GetCoinjoinCoinCandidates() => Coins;
+
public IEnumerable<SmartTransaction> GetTransactions()
{
var walletTransactions = new List<SmartTransaction>();
@@ -108,8 +138,6 @@ public class Wallet : BackgroundService, IWallet
return walletTransactions.OrderByBlockchain().ToList();
}
- public IEnumerable<SmartCoin> GetCoinjoinCoinCandidates() => Coins;
-
private double GetPrivacyPercentage(CoinsView coins, int privateThreshold)
{
var privateAmount = coins.FilterBy(x => x.IsPrivate(privateThreshold)).TotalAmount();
@@ -123,20 +151,6 @@ public class Wallet : BackgroundService, IWallet
return pcPrivate;
}
- public Network Network { get; }
- public TransactionProcessor TransactionProcessor { get; private set; }
-
- public HybridFeeProvider FeeProvider { get; private set; }
- public FilterModel LastProcessedFilter { get; private set; }
- public IBlockProvider BlockProvider { get; private set; }
- private AsyncLock HandleFiltersLock { get; }
-
- public bool IsLoggedIn { get; private set; }
-
- public Kitchen Kitchen { get; } = new();
-
- public bool IsUnderPlebStop => Coins.TotalAmount() <= KeyManager.PlebStopThreshold;
-
public bool TryLogin(string password, out string? compatibilityPasswordUsed)
{
compatibilityPasswordUsed = null;
@@ -434,8 +448,11 @@ public class Wallet : BackgroundService, IWallet
}
// Go through the filters and queue to download the matches.
- await BitcoinStore.IndexStore.ForeachFiltersAsync(async (filterModel) => await ProcessFilterModelAsync(filterModel, cancel).ConfigureAwait(false),
- new Height(bestKeyManagerHeight.Value + 1), cancel).ConfigureAwait(false);
+ await BitcoinStore.IndexStore.ForeachFiltersAsync(
+ async (filterModel) =>
+ await ProcessFilterModelAsync(filterModel, cancel).ConfigureAwait(false),
+ new Height(bestKeyManagerHeight.Value + 1),
+ cancel).ConfigureAwait(false);
}
private async Task LoadDummyMempoolAsync()
@@ -532,16 +549,4 @@ public class Wallet : BackgroundService, IWallet
var excludedOutpoints = Coins.Where(c => c.IsExcludedFromCoinJoin).Select(c => c.Outpoint);
KeyManager.SetExcludedCoinsFromCoinJoin(excludedOutpoints);
}
-
- public bool IsMixable =>
- State == WalletState.Started // Only running wallets
- && !KeyManager.IsWatchOnly // that are not watch-only wallets
- && Kitchen.HasIngredients;
-
- public IKeyChain? KeyChain { get; }
-
- public IDestinationProvider DestinationProvider { get; }
- public int AnonScoreTarget => KeyManager.AnonScoreTarget;
- public bool ConsolidationMode => false;
- public TimeSpan FeeRateMedianTimeFrame => TimeSpan.FromHours(KeyManager.FeeRateMedianTimeFrameHours);
}

Fix CF + P2pTests