Elevate out network fees to variables for readability and debugability.
MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -332,7 +332,10 @@ namespace WalletWasabi.Services
// Make sure change is counted.
Money minAmountBack = ongoingRound.CoinsRegistered.Sum(x => x.Amount); // Start with input sum.
// Do outputs.lenght + 1 in case the server estimated the network fees wrongly due to insufficient data in an edge case.
- minAmountBack -= ongoingRound.State.FeePerOutputs * (myOutputs.Length + 1) + ongoingRound.State.FeePerInputs * ongoingRound.Registration.CoinsRegistered.Count(); // Minus miner fee.
+ Money networkFeesAfterOutputs = ongoingRound.State.FeePerOutputs * (myOutputs.Length + 1);
+ Money networkFeesAfterInputs = ongoingRound.State.FeePerInputs * ongoingRound.Registration.CoinsRegistered.Count();
+ Money networkFees = networkFeesAfterOutputs + networkFeesAfterInputs;
+ minAmountBack -= networkFees; // Minus miner fee.
IOrderedEnumerable<(Money value, int count)> indistinguishableOutputs = unsignedCoinJoin.GetIndistinguishableOutputs(includeSingle: false).OrderByDescending(x => x.count);
foreach ((Money value, int count) denomPair in indistinguishableOutputs)

Elevate out network fees to variables for readability and debugability.