diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index 831a63435..87558ab0d 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -78,7 +78,9 @@ ElDialog { text: invoice.invoiceType == Invoice.OnchainInvoice ? qsTr('On chain') : invoice.invoiceType == Invoice.LightningInvoice - ? qsTr('Lightning') + ? invoice.address + ? qsTr('Lightning with on-chain fallback address') + : qsTr('Lightning') : '' Layout.fillWidth: true } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 96bad9a02..957817a27 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -255,11 +255,11 @@ Item { height: parent.height onDoPay: { - if (invoice.invoiceType == Invoice.OnchainInvoice) { + if (invoice.invoiceType == Invoice.OnchainInvoice || (invoice.invoiceType == Invoice.LightningInvoice && invoice.amount.satsInt > Daemon.currentWallet.lightningCanSend ) ) { var dialog = confirmPaymentDialog.createObject(mainView, { - 'address': invoice.address, - 'satoshis': invoice.amount, - 'message': invoice.message + address: invoice.address, + satoshis: invoice.amount, + message: invoice.message }) var canComplete = !Daemon.currentWallet.isWatchOnly && Daemon.currentWallet.canSignWithoutCosigner dialog.txaccepted.connect(function() { diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 03bd923e9..7b8bec520 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -27,8 +27,7 @@ class QEInvoice(QObject): Invalid = -1 OnchainInvoice = 0 LightningInvoice = 1 - LightningAndOnchainInvoice = 2 - LNURLPayRequest = 3 + LNURLPayRequest = 2 class Status: Unpaid = PR_UNPAID @@ -307,6 +306,10 @@ class QEInvoiceParser(QEInvoice): self.userinfo = _('Cannot pay less than the amount specified in the invoice') else: self.canPay = True + elif self.address and self.get_max_spendable_onchain() > self.amount.satsInt: + # TODO: validate address? + # TODO: subtract fee? + self.canPay = True else: self.userinfo = _('Insufficient balance') else: @@ -323,7 +326,7 @@ class QEInvoiceParser(QEInvoice): # TODO: dust limit? self.canPay = True elif self.get_max_spendable_onchain() >= self.amount.satsInt: - # TODO: dust limit? + # TODO: subtract fee? self.canPay = True else: self.userinfo = _('Insufficient balance')