Increase bitcoin node RPC workqueue
MODIFY
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
@@ -16,11 +16,31 @@ namespace WalletWasabi.Tests.Helpers
{
public static async Task<CoreNode> CreateAsync([CallerFilePath] string callerFilePath = "", [CallerMemberName] string callerMemberName = "", string additionalFolder = "", MempoolService? mempoolService = null)
{
- var network = Network.RegTest;
+ var dataDir = Path.Combine(Common.GetWorkDir(callerFilePath, callerMemberName), additionalFolder);
+
+ CoreNodeParams nodeParameters = CreateDefaultCoreNodeParams(mempoolService ?? new MempoolService(), dataDir);
+ return await CoreNode.CreateAsync(
+ nodeParameters,
+ CancellationToken.None);
+ }
+
+ public static async Task<CoreNode> CreateForHeavyConcurrencyAsync([CallerFilePath] string callerFilePath = "", [CallerMemberName] string callerMemberName = "", string additionalFolder = "", MempoolService? mempoolService = null)
+ {
+ var dataDir = Path.Combine(Common.GetWorkDir(callerFilePath, callerMemberName), additionalFolder);
+
+ CoreNodeParams nodeParameters = CreateDefaultCoreNodeParams(mempoolService ?? new MempoolService(), dataDir);
+ nodeParameters.RpcWorkQueue = 32;
+ return await CoreNode.CreateAsync(
+ nodeParameters,
+ CancellationToken.None);
+ }
+
+ private static CoreNodeParams CreateDefaultCoreNodeParams(MempoolService mempoolService, string dataDir)
+ {
var nodeParameters = new CoreNodeParams(
- network,
+ Network.RegTest,
mempoolService ?? new MempoolService(),
- Path.Combine(Common.GetWorkDir(callerFilePath, callerMemberName), additionalFolder),
+ dataDir,
tryRestart: true,
tryDeleteDataDir: true,
EndPointStrategy.Random,
@@ -38,9 +58,7 @@ namespace WalletWasabi.Tests.Helpers
nodeParameters.Upnp = 0;
nodeParameters.NatPmp = 0;
nodeParameters.PersistMempool = 0;
- return await CoreNode.CreateAsync(
- nodeParameters,
- CancellationToken.None);
+ return nodeParameters;
}
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -137,7 +137,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
const int NumberOfCoinsPerParticipant = 2;
int expectedInputNumber = NumberOfParticipants * NumberOfCoinsPerParticipant;
- var rpc = GetStatefullMockRpc();
+ var node = await TestNodeBuilder.CreateForHeavyConcurrencyAsync();
+ var rpc = node.RpcClient;
var httpClient = _apiApplicationFactory.WithWebHostBuilder(builder =>
{

MODIFY
WalletWasabi/BitcoinCore/CoreNode.cs
WalletWasabi/BitcoinCore/CoreNode.cs
@@ -201,6 +201,16 @@ namespace WalletWasabi.BitcoinCore
desiredConfigLines.Add($"{configPrefix}.persistmempool = {coreNodeParams.PersistMempool}");
}
+ if (coreNodeParams.RpcWorkQueue is { })
+ {
+ desiredConfigLines.Add($"{configPrefix}.rpcworkqueue = {coreNodeParams.RpcWorkQueue}");
+ }
+
+ if (coreNodeParams.RpcThreads is { })
+ {
+ desiredConfigLines.Add($"{configPrefix}.rpcthreads = {coreNodeParams.RpcThreads}");
+ }
+
var sectionComment = $"# The following configuration options were added or modified by Wasabi Wallet.";
// If the comment is not already present.
// And there would be new config entries added.

MODIFY
WalletWasabi/BitcoinCore/CoreNodeParams.cs
WalletWasabi/BitcoinCore/CoreNodeParams.cs
@@ -57,6 +57,9 @@ namespace WalletWasabi.BitcoinCore
public int? Upnp { get; set; }
public int? NatPmp { get; set; }
public int? PersistMempool { get; set; }
+ public int? RpcWorkQueue { get; set; }
+ public int? RpcThreads { get; set; }
+
public EndPointStrategy P2pEndPointStrategy { get; }
public EndPointStrategy RpcEndPointStrategy { get; }
public IMemoryCache Cache { get; }

Increase bitcoin node RPC workqueue