qml: emit error when bip21 contains neither an address nor a lightning invoice (fixes #8662)
This commit is contained in:
@@ -545,13 +545,15 @@ class QEInvoiceParser(QEInvoice):
|
||||
self._validateRecipient_bip21_onchain(self._pi.bip21)
|
||||
|
||||
def _validateRecipient_bip21_onchain(self, bip21: Dict[str, Any]) -> None:
|
||||
if 'amount' not in bip21:
|
||||
amount = 0
|
||||
else:
|
||||
amount = bip21['amount']
|
||||
if 'address' not in bip21:
|
||||
self._logger.debug('Neither LN invoice nor address in bip21 uri')
|
||||
self.validationError.emit('unknown', _('Unknown invoice'))
|
||||
return
|
||||
|
||||
amount = bip21.get('amount', 0)
|
||||
outputs = [PartialTxOutput.from_address_and_value(bip21['address'], amount)]
|
||||
self._logger.debug(outputs)
|
||||
message = bip21['message'] if 'message' in bip21 else ''
|
||||
message = bip21.get('message', '')
|
||||
invoice = self.create_onchain_invoice(outputs, message, None, bip21)
|
||||
self._logger.debug(repr(invoice))
|
||||
self.setValidOnchainInvoice(invoice)
|
||||
|
||||
Reference in New Issue
Block a user