Implement parallel rounds
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -81,7 +81,7 @@ public partial class Arena : PeriodicRunner
await CreateRoundsAsync(cancel).ConfigureAwait(false);
// RoundStates have to contain all states. Do not change stateId=0.
- RoundStates = Rounds.Select(r => RoundState.FromRound(r, stateId: 0)).ToImmutableArray();
+ RoundStates = Rounds.OrderBy(x => x.InputCount).Select(r => RoundState.FromRound(r, stateId: 0)).ToImmutableArray();
}
}
@@ -384,7 +384,9 @@ public partial class Arena : PeriodicRunner
private async Task CreateRoundsAsync(CancellationToken cancellationToken)
{
- if (!Rounds.Any(x => x is not BlameRound && x.Phase == Phase.InputRegistration))
+ var registrableRoundCount = Rounds.Count(x => x is not BlameRound && x.Phase == Phase.InputRegistration);
+ int roundsToCreate = Config.ParallelRounds - registrableRoundCount;
+ for (int i = 0; i < roundsToCreate; i++)
{
var feeRate = (await Rpc.EstimateSmartFeeAsync((int)Config.ConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, cancellationToken).ConfigureAwait(false)).FeeRate;

MODIFY
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
@@ -108,6 +108,10 @@ public class WabiSabiConfig : ConfigBase
[JsonConverter(typeof(MoneyBtcJsonConverter))]
public Money MaxSuggestedAmountBase { get; set; } = Money.Coins(0.1m);
+ [DefaultValue(1)]
+ [JsonProperty(PropertyName = "ParallelRounds", DefaultValueHandling = DefaultValueHandling.Populate)]
+ public int ParallelRounds { get; set; } = 1;
+
public Script GetNextCleanCoordinatorScript() => DeriveCoordinatorScript(CoordinatorExtPubKeyCurrentDepth);
public Script DeriveCoordinatorScript(int index) => CoordinatorExtPubKey.Derive(0, false).Derive(index, false).PubKey.WitHash.ScriptPubKey;

Implement parallel rounds