Move calculation where it is needed
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -149,9 +149,6 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
{
foreach (var round in Rounds.Where(x => x.Phase == Phase.OutputRegistration).ToArray())
{
- long aliceSum = round.Alices.Sum(x => x.CalculateRemainingAmountCredentials(round.FeeRate));
- long bobSum = round.Bobs.Sum(x => x.CredentialAmount);
- var diff = aliceSum - bobSum;
var allReady = round.Alices.All(a => a.ReadyToSign);
if (allReady || round.OutputRegistrationTimeFrame.HasExpired)
@@ -161,6 +158,10 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
round.LogInfo($"{coinjoin.Inputs.Count} inputs were added.");
round.LogInfo($"{coinjoin.Outputs.Count} outputs were added.");
+ long aliceSum = round.Alices.Sum(x => x.CalculateRemainingAmountCredentials(round.FeeRate));
+ long bobSum = round.Bobs.Sum(x => x.CredentialAmount);
+ var diff = aliceSum - bobSum;
+
// If timeout we must fill up the outputs to build a reasonable transaction.
// This won't be signed by the alice who failed to provide output, so we know who to ban.
var diffMoney = Money.Satoshis(diff) - coinjoin.Parameters.FeeRate.GetFee(Config.BlameScript.EstimateOutputVsize());

Move calculation where it is needed