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:
@@ -119,10 +119,13 @@ class Invoice(StoredObject):
|
||||
|
||||
def get_address(self) -> Optional[str]:
|
||||
"""returns the first address, to be displayed in GUI"""
|
||||
if self.is_lightning():
|
||||
return self._lnaddr.get_fallback_address() or None
|
||||
else:
|
||||
return self.outputs[0].address
|
||||
address = None
|
||||
if self.outputs:
|
||||
address = self.outputs[0].address if len(self.outputs) > 0 else None
|
||||
if not address:
|
||||
if self.is_lightning():
|
||||
address = self._lnaddr.get_fallback_address() or None
|
||||
return address
|
||||
|
||||
def get_outputs(self):
|
||||
if self.is_lightning():
|
||||
|
||||
Reference in New Issue
Block a user