Use HttpClientFactory instead of Synchronizer (P2pBlockProvider.cs)
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -327,7 +327,7 @@ namespace WalletWasabi.Gui
var blockProvider = new CachedBlockProvider(
new SmartBlockProvider(
- new P2pBlockProvider(Nodes, BitcoinCoreNode, Synchronizer, Config.ServiceConfiguration, Network),
+ new P2pBlockProvider(Nodes, BitcoinCoreNode, HttpClientFactory, Config.ServiceConfiguration, Network),
Cache),
BitcoinStore.BlockRepository);

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -98,7 +98,7 @@ namespace WalletWasabi.Tests.IntegrationTests
WasabiSynchronizer syncer = new WasabiSynchronizer(network, bitcoinStore, httpClientFactory);
ServiceConfiguration serviceConfig = new ServiceConfiguration(MixUntilAnonymitySet.PrivacyLevelStrong.ToString(), 2, 21, 50, new IPEndPoint(IPAddress.Loopback, network.DefaultPort), Money.Coins(Constants.DefaultDustThreshold));
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, syncer, serviceConfig, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfig, network),
bitcoinStore.BlockRepository);
using Wallet wallet = Wallet.CreateAndRegisterServices(

MODIFY
WalletWasabi.Tests/RegressionTests/BuildTests.cs
WalletWasabi.Tests/RegressionTests/BuildTests.cs
@@ -61,7 +61,7 @@ namespace WalletWasabi.Tests.RegressionTests
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, nodes, workDir, serviceConfiguration, synchronizer, blockProvider);
@@ -225,7 +225,7 @@ namespace WalletWasabi.Tests.RegressionTests
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
var walletManager = new WalletManager(network, workDir, new WalletDirectories(network, workDir));
walletManager.RegisterServices(bitcoinStore, synchronizer, nodes, serviceConfiguration, synchronizer, blockProvider);

MODIFY
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
WalletWasabi.Tests/RegressionTests/CoinJoinTests.cs
@@ -1390,11 +1390,11 @@ namespace WalletWasabi.Tests.RegressionTests
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
CachedBlockProvider blockProvider2 = new CachedBlockProvider(
- new P2pBlockProvider(nodes2, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes2, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, nodes, workDir, serviceConfiguration, synchronizer, blockProvider);

MODIFY
WalletWasabi.Tests/RegressionTests/SendTests.cs
WalletWasabi.Tests/RegressionTests/SendTests.cs
@@ -59,7 +59,7 @@ namespace WalletWasabi.Tests.RegressionTests
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
var walletManager = new WalletManager(network, workDir, new WalletDirectories(network, workDir));
@@ -540,7 +540,7 @@ namespace WalletWasabi.Tests.RegressionTests
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
var walletManager = new WalletManager(network, workDir, new WalletDirectories(network, workDir));
@@ -715,7 +715,7 @@ namespace WalletWasabi.Tests.RegressionTests
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, nodes, workDir, serviceConfiguration, synchronizer, blockProvider);

MODIFY
WalletWasabi.Tests/RegressionTests/WalletTests.cs
WalletWasabi.Tests/RegressionTests/WalletTests.cs
@@ -253,7 +253,7 @@ namespace WalletWasabi.Tests.RegressionTests
var workDir = Helpers.Common.GetWorkDir();
CachedBlockProvider blockProvider = new CachedBlockProvider(
- new P2pBlockProvider(nodes, null, synchronizer, serviceConfiguration, network),
+ new P2pBlockProvider(nodes, null, httpClientFactory, serviceConfiguration, network),
bitcoinStore.BlockRepository);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, nodes, workDir, serviceConfiguration, synchronizer, blockProvider);

MODIFY
WalletWasabi/Wallets/P2pBlockProvider.cs
WalletWasabi/Wallets/P2pBlockProvider.cs
@@ -11,6 +11,7 @@ using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Models;
using WalletWasabi.Services;
+using WalletWasabi.WebClients.Wasabi;
namespace WalletWasabi.Wallets
{
@@ -22,11 +23,11 @@ namespace WalletWasabi.Wallets
{
private Node _localBitcoinCoreNode = null;
- public P2pBlockProvider(NodesGroup nodes, CoreNode coreNode, WasabiSynchronizer syncer, ServiceConfiguration serviceConfiguration, Network network)
+ public P2pBlockProvider(NodesGroup nodes, CoreNode coreNode, HttpClientFactory httpClientFactory, ServiceConfiguration serviceConfiguration, Network network)
{
Nodes = nodes;
CoreNode = coreNode;
- Synchronizer = syncer;
+ HttpClientFactory = httpClientFactory;
ServiceConfiguration = serviceConfiguration;
Network = network;
}
@@ -35,7 +36,7 @@ namespace WalletWasabi.Wallets
public NodesGroup Nodes { get; }
public CoreNode CoreNode { get; }
- public WasabiSynchronizer Synchronizer { get; }
+ public HttpClientFactory HttpClientFactory { get; }
public ServiceConfiguration ServiceConfiguration { get; }
public Network Network { get; }
@@ -168,9 +169,9 @@ namespace WalletWasabi.Wallets
// If an onion was added must try to use Tor.
// onlyForOnionHosts should connect to it if it's an onion endpoint automatically and non-Tor endpoints through clearnet/localhost
- if (Synchronizer.HttpClientFactory.IsTorEnabled)
+ if (HttpClientFactory.IsTorEnabled)
{
- nodeConnectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(Synchronizer.HttpClientFactory.TorEndpoint, onlyForOnionHosts: true, networkCredential: null, streamIsolation: false));
+ nodeConnectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(HttpClientFactory.TorEndpoint, onlyForOnionHosts: true, networkCredential: null, streamIsolation: false));
}
var localEndPoint = ServiceConfiguration.BitcoinCoreEndPoint;

Use HttpClientFactory instead of Synchronizer (P2pBlockProvider.cs)