From ca283a75d01ad3bcd7ad3deae6e4d7fc927cec15 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 26 Jun 2023 10:18:49 +0200 Subject: [PATCH] qml: exclude non-address SPK from supported payment identifiers --- electrum/gui/qml/qeinvoice.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index fa92706aa..a7c437721 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -10,7 +10,7 @@ from electrum.logging import get_logger from electrum.invoices import (Invoice, PR_UNPAID, PR_EXPIRED, PR_UNKNOWN, PR_PAID, PR_INFLIGHT, PR_FAILED, PR_ROUTING, PR_UNCONFIRMED, PR_BROADCASTING, PR_BROADCAST, LN_EXPIRY_NEVER) from electrum.lnaddr import LnInvoiceException -from electrum.transaction import PartialTxOutput +from electrum.transaction import PartialTxOutput, TxOutput from electrum.util import InvoiceError, get_asyncio_loop from electrum.lnutil import format_short_channel_id, IncompatibleOrInsaneFeatures from electrum.lnurl import decode_lnurl, request_lnurl, callback_lnurl @@ -496,6 +496,12 @@ class QEInvoiceParser(QEInvoice): self.validationError.emit('unknown', _('Unknown invoice')) return + if self._pi.type == PaymentIdentifierType.SPK: + txo = TxOutput(scriptpubkey=self._pi.spk, value=0) + if not txo.address: + self.validationError.emit('unknown', _('Unknown invoice')) + return + self._update_from_payment_identifier() def _update_from_payment_identifier(self):