P2pBlockProvider: Change ctor signature
MODIFY
WalletWasabi.Fluent/Global.cs
WalletWasabi.Fluent/Global.cs
@@ -191,7 +191,7 @@ public class Global
var blockProvider = new SmartBlockProvider(
BitcoinStore.BlockRepository,
new LocalBlockProvider(Network, Config.ServiceConfiguration, BitcoinCoreNode, HttpClientFactory),
- new P2pBlockProvider(HostedServices.Get<P2pNetwork>().Nodes, HttpClientFactory, Network),
+ new P2pBlockProvider(Network, HostedServices.Get<P2pNetwork>().Nodes, HttpClientFactory),
Cache);
WalletManager.RegisterServices(BitcoinStore, Synchronizer, Config.ServiceConfiguration, HostedServices.Get<HybridFeeProvider>(), blockProvider);

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -112,7 +112,7 @@ public class P2pTests
IBlockProvider blockProvider = new SmartBlockProvider(
blockRepository,
new LocalBlockProvider(network, serviceConfig, null, httpClientFactory),
- new P2pBlockProvider(nodes, httpClientFactory, network),
+ new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
using Wallet wallet = Wallet.CreateAndRegisterServices(

MODIFY
WalletWasabi.Tests/RegressionTests/BuildTests.cs
WalletWasabi.Tests/RegressionTests/BuildTests.cs
@@ -67,7 +67,7 @@ public class BuildTests
var blockProvider = new SmartBlockProvider(
bitcoinStore.BlockRepository,
localBlockProvider: new LocalBlockProvider(network, serviceConfiguration, coreNode: null, httpClientFactory: httpClientFactory),
- p2PBlockProvider: new P2pBlockProvider(nodes, httpClientFactory, network),
+ p2PBlockProvider: new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, workDir, serviceConfiguration, feeProvider, blockProvider);
@@ -224,7 +224,7 @@ public class BuildTests
var blockProvider = new SmartBlockProvider(
bitcoinStore.BlockRepository,
localBlockProvider: new LocalBlockProvider(network, serviceConfiguration, coreNode: null, httpClientFactory: httpClientFactory),
- p2PBlockProvider: new P2pBlockProvider(nodes, httpClientFactory, network),
+ p2PBlockProvider: new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
WalletManager walletManager = new(network, workDir, new WalletDirectories(network, workDir));

MODIFY
WalletWasabi.Tests/RegressionTests/SendTests.cs
WalletWasabi.Tests/RegressionTests/SendTests.cs
@@ -65,7 +65,7 @@ public class SendTests
var blockProvider = new SmartBlockProvider(
bitcoinStore.BlockRepository,
new LocalBlockProvider(network, serviceConfiguration, null, httpClientFactory),
- new P2pBlockProvider(nodes, httpClientFactory, network),
+ new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
WalletManager walletManager = new(network, workDir, new WalletDirectories(network, workDir));
@@ -547,7 +547,7 @@ public class SendTests
var blockProvider = new SmartBlockProvider(
bitcoinStore.BlockRepository,
new LocalBlockProvider(network, serviceConfiguration, null, httpClientFactory),
- new P2pBlockProvider(nodes, httpClientFactory, network),
+ new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
WalletManager walletManager = new(network, workDir, new WalletDirectories(network, workDir));
@@ -725,7 +725,7 @@ public class SendTests
var blockProvider = new SmartBlockProvider(
bitcoinStore.BlockRepository,
new LocalBlockProvider(network, serviceConfiguration, null, httpClientFactory),
- new P2pBlockProvider(nodes, httpClientFactory, network),
+ new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, workDir, serviceConfiguration, feeProvider, blockProvider);

MODIFY
WalletWasabi.Tests/RegressionTests/WalletTests.cs
WalletWasabi.Tests/RegressionTests/WalletTests.cs
@@ -259,7 +259,7 @@ public class WalletTests
SmartBlockProvider blockProvider = new(
blockRepository,
new LocalBlockProvider(network, serviceConfiguration, null, httpClientFactory),
- new P2pBlockProvider(nodes, httpClientFactory, network),
+ new P2pBlockProvider(network, nodes, httpClientFactory),
cache);
using var wallet = Wallet.CreateAndRegisterServices(network, bitcoinStore, keyManager, synchronizer, workDir, serviceConfiguration, feeProvider, blockProvider);

MODIFY
WalletWasabi/Wallets/LocalBlockProvider.cs
WalletWasabi/Wallets/LocalBlockProvider.cs
@@ -18,9 +18,9 @@ public class LocalBlockProvider : IBlockProvider
public LocalBlockProvider(Network network, ServiceConfiguration serviceConfiguration, CoreNode? coreNode, HttpClientFactory httpClientFactory)
{
- CoreNode = coreNode;
Network = network;
ServiceConfiguration = serviceConfiguration;
+ CoreNode = coreNode;
HttpClientFactory = httpClientFactory;
}

MODIFY
WalletWasabi/Wallets/P2pBlockProvider.cs
WalletWasabi/Wallets/P2pBlockProvider.cs
@@ -14,16 +14,16 @@ namespace WalletWasabi.Wallets;
/// </summary>
public class P2pBlockProvider : IBlockProvider
{
- public P2pBlockProvider(NodesGroup nodes, HttpClientFactory httpClientFactory, Network network)
+ public P2pBlockProvider(Network network, NodesGroup nodes, HttpClientFactory httpClientFactory)
{
+ Network = network;
Nodes = nodes;
HttpClientFactory = httpClientFactory;
- Network = network;
}
+ private Network Network { get; }
private NodesGroup Nodes { get; }
private HttpClientFactory HttpClientFactory { get; }
- private Network Network { get; }
private int NodeTimeouts { get; set; }
@@ -147,6 +147,7 @@ public class P2pBlockProvider : IBlockProvider
// Sanity check
var minTimeout = Network == Network.Main ? 3 : 2;
minTimeout = HttpClientFactory.IsTorEnabled ? (int)Math.Round(minTimeout * 1.5) : minTimeout;
+
if (timeout < minTimeout)
{
timeout = minTimeout;
@@ -160,6 +161,7 @@ public class P2pBlockProvider : IBlockProvider
{
return;
}
+
RuntimeParams.Instance.NetworkNodeTimeout = timeout;
await RuntimeParams.Instance.SaveAsync().ConfigureAwait(false);

P2pBlockProvider: Change ctor signature