From 6fd41c0f265caf0927f5d94e6acabd6ba4023039 Mon Sep 17 00:00:00 2001 From: Kuro Date: Thu, 17 Jun 2021 03:05:41 +0800 Subject: [PATCH] Handle Lelantus AmountWithFeeExceedsBalance --- src/qt/walletmodel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 390e768c4b..dc49f7c7d4 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -521,6 +521,9 @@ WalletModel::SendCoinsReturn WalletModel::prepareJoinSplitTransaction( *newTx = wallet->CreateLelantusJoinSplitTransaction(vecSend, feeRequired, {}, spendCoins, sigmaSpendCoins, mintCoins, coinControl); } catch (InsufficientFunds const&) { transaction.setTransactionFee(feeRequired); + if (!fSubtractFeeFromAmount && (total + feeRequired) > nBalance) { + return SendCoinsReturn(AmountWithFeeExceedsBalance); + } return SendCoinsReturn(AmountExceedsBalance); } catch (std::runtime_error const &e) { Q_EMIT message(