]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
send: improve error messages for not_enough_unlocked_money
authortobtoht <tob@featherwallet.org>
Wed, 25 Oct 2023 23:23:22 +0000 (01:23 +0200)
committertobtoht <tob@featherwallet.org>
Wed, 25 Oct 2023 23:24:01 +0000 (01:24 +0200)
monero
src/MainWindow.cpp
src/SendWidget.cpp

diff --git a/monero b/monero
index 1f068d1ee84849b3b1758b0a46844834019de1bc..4e02392274e1b5f7a038171deee2e445128b2e35 160000 (submodule)
--- a/monero
+++ b/monero
@@ -1 +1 @@
-Subproject commit 1f068d1ee84849b3b1758b0a46844834019de1bc
+Subproject commit 4e02392274e1b5f7a038171deee2e445128b2e35
index 15290a2f333e97b6d78e9fe3a2b4c19e60de5f3f..5538e75a748c750e39660ae0c1af23d23224830a 100644 (file)
@@ -732,7 +732,14 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
                 message.helpItems = {"Your transaction has too many inputs. Try sending a lower amount."};
             }
             catch (const tools::error::not_enough_unlocked_money &e) {
-                message.description = QString("Not enough unlocked balance.\n\nUnlocked balance: %1\nTransaction spends: %2").arg(e.available(), e.tx_amount());
+                QString error;
+                if (e.fee() > e.available()) {
+                    error = QString("Transaction fee exceeds spendable balance.\n\nSpendable balance: %1\nTransaction fee: %2").arg(WalletManager::displayAmount(e.available()), WalletManager::displayAmount(e.fee()));
+                }
+                else {
+                    error = QString("Spendable balance insufficient to pay for transaction.\n\nSpendable balance: %1\nTransaction needs: %2").arg(WalletManager::displayAmount(e.available()), WalletManager::displayAmount(e.tx_amount() + e.fee()));
+                }
+                message.description = error;
                 message.helpItems = {"Wait for more balance to unlock.", "Click 'Help' to learn more about how balance works."};
                 message.doc = "balance";
             }
index c012a3a9c6ebe1e42e2e648be24766e499f4c33d..6edc132af71ffc726214d7e6785df88992fa051c 100644 (file)
@@ -212,6 +212,11 @@ void SendWidget::sendClicked() {
         return;
     }
 
+    if (unlocked_balance == 0) {
+        Utils::showError(this, "Unable to create transaction", QString("No spendable balance.\n\n%1 XMR becomes spendable within 10 blocks (~20 minutes).").arg(WalletManager::displayAmount(total_balance - unlocked_balance)), {"Wait for more balance to unlock.", "Click 'Help' to learn more about how balance works."}, "balance");
+        return;
+    }
+
     if (!sendAll && amount > unlocked_balance) {
         Utils::showError(this, "Unable to create transaction", QString("Not enough money to spend.\n\n"
                                                                        "Spendable balance: %1").arg(WalletManager::displayAmount(unlocked_balance)));