From 71801de7ea2e98c66ef3c4a740520b5f87f06e90 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 26 Mar 2025 11:55:31 +0100 Subject: [PATCH] qml: show insufficient balance text for lightning invoice without fallback and insufficient ln send capacity --- electrum/gui/qml/components/InvoiceDialog.qml | 4 +++- electrum/gui/qml/qeinvoice.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index 0a52b73a4..aa89d1d97 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -63,7 +63,9 @@ ElDialog { : invoice.status == Invoice.Paid ? InfoTextArea.IconStyle.Done : invoice.status == Invoice.Unpaid && invoice.expiration > 0 - ? InfoTextArea.IconStyle.Pending + ? invoice.canPay + ? InfoTextArea.IconStyle.Pending + : InfoTextArea.IconStyle.Error : InfoTextArea.IconStyle.Info } diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index e960dd39d..ac7bbbf7f 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -327,9 +327,8 @@ class QEInvoice(QObject, QtEventListener): lnaddr = self._effectiveInvoice._lnaddr if lnaddr.amount and amount.satsInt < lnaddr.amount * COIN: self.userinfo = _('Cannot pay less than the amount specified in the invoice') - elif self.address and self.get_max_spendable_onchain() < amount.satsInt: - # TODO: validate address? - # TODO: subtract fee? + elif not self.address or self.get_max_spendable_onchain() < amount.satsInt: + # TODO: for onchain: validate address? subtract fee? self.userinfo = _('Insufficient balance') else: self.userinfo = userinfo_for_invoice_status(self.status)