Improve MempoolService.
MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -362,7 +362,7 @@ namespace WalletWasabi.Gui.ViewModels
{
if (LegalDocuments is null || LegalDocuments.Version < x.LegalDocumentsVersion)
{
- using var client = new WasabiClient(() => Config.UseTor ? Config.GetCurrentBackendUri() : Config.GetFallbackBackendUri(), Config.UseTor ? Config.TorSocks5EndPoint : null);
+ using WasabiClient client = Synchronizer.WasabiClientFactory.NewBackendClient();
var versions = await client.GetVersionsAsync(CancellationToken.None);
var version = versions.LegalDocumentsVersion;
var legalFolderPath = Path.Combine(DataDir, LegalDocuments.LegalFolderName);

MODIFY
WalletWasabi.Tests/RegressionTests/Common.cs
WalletWasabi.Tests/RegressionTests/Common.cs
@@ -52,7 +52,7 @@ namespace WalletWasabi.Tests.RegressionTests
var firstHash = await global.RpcClient.GetBlockHashAsync(0);
while (true)
{
- using var client = new WasabiClient(new Uri(regTestFixture.BackendEndPoint), null);
+ using var client = new WasabiClient(new Uri(regTestFixture.BackendEndPoint), torSocks5EndPoint: null);
FiltersResponse filtersResponse = await client.GetFiltersAsync(firstHash, 1000);
Assert.NotNull(filtersResponse);

MODIFY
WalletWasabi/Blockchain/Mempool/MempoolService.cs
WalletWasabi/Blockchain/Mempool/MempoolService.cs
@@ -95,7 +95,7 @@ namespace WalletWasabi.Blockchain.Mempool
/// <summary>
/// Tries to perform mempool cleanup with the help of the backend.
/// </summary>
- public async Task<bool> TryPerformMempoolCleanupAsync(Func<Uri> destAction, EndPoint? torSocks)
+ public async Task<bool> TryPerformMempoolCleanupAsync(WasabiClientFactory wasabiClientFactory)
{
// If already cleaning, then no need to run it that often.
if (Interlocked.CompareExchange(ref _cleanupInProcess, 1, 0) == 1)
@@ -114,7 +114,7 @@ namespace WalletWasabi.Blockchain.Mempool
}
Logger.LogInfo("Start cleaning out mempool...");
- using (var client = new WasabiClient(destAction, torSocks))
+ using (var client = wasabiClientFactory.NewBackendClient())
{
var compactness = 10;
var allMempoolHashes = await client.GetMempoolHashesAsync(compactness).ConfigureAwait(false);

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
@@ -375,7 +375,7 @@ namespace WalletWasabi.Wallets
}
} while (Synchronizer.AreRequestsBlocked()); // If requests are blocked, delay mempool cleanup, because coinjoin answers are always priority.
- var task = BitcoinStore.MempoolService?.TryPerformMempoolCleanupAsync(Synchronizer.WasabiClientFactory.BackendUriGetter, Synchronizer.WasabiClientFactory.TorEndpoint);
+ var task = BitcoinStore.MempoolService?.TryPerformMempoolCleanupAsync(Synchronizer.WasabiClientFactory);
if (task is { })
{

Improve MempoolService.