throw TransactionSizeException
MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
@@ -571,7 +571,7 @@ public class TransactionFactoryTests
Assert.Equal(ChangeStrategy.Auto, payment.ChangeStrategy);
- Assert.Throws<InsufficientBalanceException>(() => transactionFactory.BuildTransaction(payment, new FeeRate(12m)));
+ Assert.Throws<TransactionSizeException>(() => transactionFactory.BuildTransaction(payment, new FeeRate(12m)));
}
[Fact]

MODIFY
WalletWasabi/Blockchain/TransactionBuilding/SmartCoinSelector.cs
WalletWasabi/Blockchain/TransactionBuilding/SmartCoinSelector.cs
@@ -36,7 +36,7 @@ public class SmartCoinSelector : ICoinSelector
var suggestedSum = suggestion.Sum(c => (Money)c.Amount);
if (suggestedSum < (Money)target)
{
- throw new InsufficientBalanceException(targetMoney, suggestedSum);
+ throw new TransactionSizeException(targetMoney, suggestedSum);
}
}

ADD
WalletWasabi/Exceptions/TransactionSizeException.cs
+using NBitcoin;
+
+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 at once with your coins, is: {actual.ToString(false, true)} BTC.")
+ {
+ Minimum = minimum ?? Money.Zero;
+ Actual = actual ?? Money.Zero;
+ }
+
+ public Money Minimum { get; }
+ public Money Actual { get; }
+}

throw TransactionSizeException