1
0

Favor first output address in invoice/request instead of fallback address in LN invoice. (#8078)

Without this change, when configuring electrum with bolt11_fallback disabled, and calling
invoice.get_address() on a lightning enabled invoice, it will return None, thereby disabling
retrieving BIP21 uri or address from the invoice/request.
This commit is contained in:
accumulator
2022-11-18 17:24:32 +01:00
committed by GitHub
parent 6e3bd69e80
commit e0f6c18073

View File

@@ -119,10 +119,13 @@ class Invoice(StoredObject):
def get_address(self) -> Optional[str]: def get_address(self) -> Optional[str]:
"""returns the first address, to be displayed in GUI""" """returns the first address, to be displayed in GUI"""
if self.is_lightning(): address = None
return self._lnaddr.get_fallback_address() or None if self.outputs:
else: address = self.outputs[0].address if len(self.outputs) > 0 else None
return self.outputs[0].address if not address:
if self.is_lightning():
address = self._lnaddr.get_fallback_address() or None
return address
def get_outputs(self): def get_outputs(self):
if self.is_lightning(): if self.is_lightning():