From 9b5aae486fb1615ef912fa8e4193debb7125bc89 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Thu, 26 Oct 2023 01:23:22 +0200 Subject: [PATCH] send: improve error messages for not_enough_unlocked_money --- monero | 2 +- src/MainWindow.cpp | 9 ++++++++- src/SendWidget.cpp | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/monero b/monero index 1f068d1..4e02392 160000 --- a/monero +++ b/monero @@ -1 +1 @@ -Subproject commit 1f068d1ee84849b3b1758b0a46844834019de1bc +Subproject commit 4e02392274e1b5f7a038171deee2e445128b2e35 diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 15290a2..5538e75 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -732,7 +732,14 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector 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"; } diff --git a/src/SendWidget.cpp b/src/SendWidget.cpp index c012a3a..6edc132 100644 --- a/src/SendWidget.cpp +++ b/src/SendWidget.cpp @@ -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)));