From 6ce8a583fd626b3fa080bae087bf6c5b735af007 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 2 Nov 2023 10:24:37 +0100 Subject: [PATCH] qt: add missing case for on-chain fallback for BIP21 payment identfier containing lightning invoice --- electrum/gui/qt/send_tab.py | 2 ++ electrum/payment_identifier.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/electrum/gui/qt/send_tab.py b/electrum/gui/qt/send_tab.py index 608579e8b..06b701859 100644 --- a/electrum/gui/qt/send_tab.py +++ b/electrum/gui/qt/send_tab.py @@ -698,6 +698,8 @@ class SendTab(QWidget, MessageBoxMixin, Logger): num_sats_can_send = int(lnworker.num_sats_can_send()) msg += '\n' + _('Your channels can send {}.').format(self.format_amount(num_sats_can_send) + ' ' + self.base_unit()) if not choices: + if not can_pay_onchain: + msg += '\n' + _('Also, you have insufficient funds to pay on-chain.') self.window.show_error(msg) return r = self.window.query_choice(msg, choices) diff --git a/electrum/payment_identifier.py b/electrum/payment_identifier.py index ad7b9221a..1b2e3dbf6 100644 --- a/electrum/payment_identifier.py +++ b/electrum/payment_identifier.py @@ -173,6 +173,8 @@ class PaymentIdentifier(Logger): return True if self._type in [PaymentIdentifierType.LNURLP, PaymentIdentifierType.BOLT11, PaymentIdentifierType.LNADDR]: return bool(self.bolt11) and bool(self.bolt11.get_address()) + if self._type == PaymentIdentifierType.BIP21: + return bool(self.bip21.get('address', None)) or (bool(self.bolt11) and bool(self.bolt11.get_address())) def is_multiline(self): return bool(self.multiline_outputs)