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]:
|
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():
|
||||||
|
|||||||
Reference in New Issue
Block a user