Add smarter error message
Closes
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -179,6 +179,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SetWarningMessage($"Invalid amount.");
return;
}
+
+ if (amount == selectedCoinViewModels.Sum(x => x.Amount))
+ {
+ SetWarningMessage("Looks like you want to spend a whole coin. Try Max button instead.");
+ return;
+ }
}
var label = Label;
var operation = new WalletService.Operation(script, amount, label);

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -1175,15 +1175,28 @@ namespace WalletWasabi.Services
var coinsToSpend = new HashSet<SmartCoin>();
var unspentConfirmedCoins = new List<SmartCoin>();
var unspentUnconfirmedCoins = new List<SmartCoin>();
- foreach (var coin in unspentCoins)
- if (coin.Confirmed) unspentConfirmedCoins.Add(coin);
- else unspentUnconfirmedCoins.Add(coin);
+ foreach (SmartCoin coin in unspentCoins)
+ {
+ if (coin.Confirmed)
+ {
+ unspentConfirmedCoins.Add(coin);
+ }
+ else
+ {
+ unspentUnconfirmedCoins.Add(coin);
+ }
+ }
bool haveEnough = SelectCoins(ref coinsToSpend, totalOutAmount, unspentConfirmedCoins);
if (!haveEnough)
+ {
haveEnough = SelectCoins(ref coinsToSpend, totalOutAmount, unspentUnconfirmedCoins);
+ }
+
if (!haveEnough)
+ {
throw new InsufficientBalanceException(totalOutAmount, unspentConfirmedCoins.Select(x => x.Amount).Sum() + unspentUnconfirmedCoins.Select(x => x.Amount).Sum());
+ }
return coinsToSpend;
}

Add smarter error message
Closes https://github.com/zkSNACKs/WalletWasabi/issues/952