Optimize MagSuggested amount variation
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/Rounds/MultipartyTransactionStateTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/Rounds/MultipartyTransactionStateTests.cs
@@ -86,7 +86,7 @@ public class MultipartyTransactionStateTests
[InlineData(2 + 32, "1")]
[InlineData(1, "0.1")]
[InlineData(1 + 32, "0.1")]
- [InlineData(0, "0.1")]
+ [InlineData(0, "1343.75")]
public void GetSuggestedAmountsTest(int roundCounter, string amount)
{
WabiSabiConfig config = new();

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -57,7 +57,10 @@ public partial class Arena : PeriodicRunner
private ICoinJoinIdStore CoinJoinIdStore { get; set; }
private RoundParameterFactory RoundParameterFactory { get; }
- private int ConnectionConfirmationStartedCounter { get; set; }
+ /// <summary>
+ /// How many non-blame round get to the end of the Input registration phase.
+ /// </summary>
+ private int InputRegistrationFinishedCounter { get; set; }
protected override async Task ActionAsync(CancellationToken cancel)
{
@@ -102,6 +105,11 @@ public partial class Arena : PeriodicRunner
}
}
+ if (round is not BlameRound)
+ {
+ InputRegistrationFinishedCounter++;
+ }
+
if (round.InputCount < Config.MinInputCountByRound)
{
if (!round.InputRegistrationTimeFrame.HasExpired)
@@ -114,7 +122,6 @@ public partial class Arena : PeriodicRunner
else if (round.IsInputRegistrationEnded(Config.MaxInputCountByRound))
{
round.SetPhase(Phase.ConnectionConfirmation);
- ConnectionConfirmationStartedCounter++;
}
}
catch (Exception ex)
@@ -369,7 +376,7 @@ public partial class Arena : PeriodicRunner
var feeRate = (await Rpc.EstimateSmartFeeAsync((int)Config.ConfirmationTarget, EstimateSmartFeeMode.Conservative, simulateIfRegTest: true, cancellationToken).ConfigureAwait(false)).FeeRate;
RoundParameters parameters =
- RoundParameterFactory.CreateRoundParameter(feeRate, ConnectionConfirmationStartedCounter);
+ RoundParameterFactory.CreateRoundParameter(feeRate, InputRegistrationFinishedCounter);
Round r = new(parameters, SecureRandom.Instance);
Rounds.Add(r);
r.LogInfo($"Created round with params: {nameof(parameters.MaxSuggestedAmount)}:'{parameters.MaxSuggestedAmount}' BTC.");

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/MaxSuggestedAmountProvider.cs
WalletWasabi/WabiSabi/Backend/Rounds/MaxSuggestedAmountProvider.cs
@@ -62,7 +62,8 @@ public class MaxSuggestedAmountProvider
}
}
- return RoundCounterDividerAndMaxAmounts.Last().MaxValue;
+ // We always start with the largest whale round.
+ return RoundCounterDividerAndMaxAmounts.First().MaxValue;
}
private record DividerMaxValue(int Divider, Money MaxValue);

Optimize MagSuggested amount variation