From ae8c4f1281f972151e50f067390f8aa39601cdf7 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Sat, 8 Jul 2023 12:19:37 +0200 Subject: [PATCH] payment_identifier: check if payment identifier is usable and enable/disable Send/Pay buttons --- electrum/gui/qt/send_tab.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qt/send_tab.py b/electrum/gui/qt/send_tab.py index 94838c248..2dfe8be09 100644 --- a/electrum/gui/qt/send_tab.py +++ b/electrum/gui/qt/send_tab.py @@ -426,8 +426,11 @@ class SendTab(QWidget, MessageBoxMixin, Logger): else: self.amount_e.setToolTip('') - self.send_button.setEnabled(bool(self.amount_e.get_amount()) and not pi.has_expired() and not pi.is_error()) - self.save_button.setEnabled(not pi.is_error() and pi.type not in [PaymentIdentifierType.LNURLP, PaymentIdentifierType.LNADDR]) + pi_unusable = pi.is_error() or (not self.wallet.has_lightning() and not pi.is_onchain()) + + self.send_button.setEnabled(not pi_unusable and bool(self.amount_e.get_amount()) and not pi.has_expired()) + self.save_button.setEnabled(not pi_unusable and pi.type not in [PaymentIdentifierType.LNURLP, + PaymentIdentifierType.LNADDR]) def _handle_payment_identifier(self): self.update_fields()