Fix iteration counter
MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
@@ -577,7 +577,7 @@ public class TransactionFactoryTests
Assert.Equal(ChangeStrategy.Auto, payment.ChangeStrategy);
TransactionSizeException ex = Assert.Throws<TransactionSizeException>(() => transactionFactory.BuildTransaction(payment, new FeeRate(12m)));
- Assert.Equal(paymentAmount, ex.Minimum);
+ Assert.Equal(paymentAmount, ex.Target);
Assert.Equal(Money.Coins(0.23022846m), ex.Actual);
}

MODIFY
WalletWasabi/Blockchain/TransactionBuilding/SmartCoinSelector.cs
WalletWasabi/Blockchain/TransactionBuilding/SmartCoinSelector.cs
@@ -37,8 +37,8 @@ public class SmartCoinSelector : ICoinSelector
throw new TimeoutException("Coin selection timed out.");
}
- // This is a hacky safety check to make sure the first few iterations can go through.
- if (IterationCount > 10)
+ // The first iteration should never take suggested coins into account .
+ if (IterationCount > 0)
{
Money suggestedSum = Money.Satoshis(suggestion.Sum(c => (Money)c.Amount));
if (suggestedSum < targetMoney)

MODIFY
WalletWasabi/Exceptions/TransactionSizeException.cs
WalletWasabi/Exceptions/TransactionSizeException.cs
@@ -4,13 +4,13 @@ namespace WalletWasabi.Exceptions;
public class TransactionSizeException : Exception
{
- public TransactionSizeException(Money minimum, Money actual)
- : base($"Transaction size over the limit. Needed {minimum.ToString(false, true)} BTC. The maximum amount you can spent your coins is {actual.ToString(false, true)} BTC at the moment.")
+ public TransactionSizeException(Money target, Money maximumPossible)
+ : base($"Transaction size over the limit. Needed {target.ToString(false, true)} BTC. The maximum amount you can spent your coins is {maximumPossible.ToString(false, true)} BTC at the moment.")
{
- Minimum = minimum ?? Money.Zero;
- Actual = actual ?? Money.Zero;
+ Target = target ?? Money.Zero;
+ MaximumPossible = maximumPossible ?? Money.Zero;
}
- public Money Minimum { get; }
- public Money Actual { get; }
+ public Money Target { get; }
+ public Money MaximumPossible { get; }
}

Fix iteration counter