1
0

qt send: use bolt11 fallback addr even if LN is disabled

Given a wallet with LN disabled,
and a bolt11 invoice (or a bip21 uri that only contains bolt11 but lacks a top-level address),
if the bolt11 invoice includes a fallback address,
we would previously just error "Lightning is disabled".

Now we offer the user to pay on-chain using the fallback address.

closes https://github.com/spesmilo/electrum/issues/8047
This commit is contained in:
SomberNight
2022-10-31 19:15:03 +00:00
parent 2fd762c308
commit df2d0f4e1f
2 changed files with 27 additions and 16 deletions

View File

@@ -136,6 +136,12 @@ class Invoice(StoredObject):
outputs = self.outputs
return outputs
def can_be_paid_onchain(self) -> bool:
if self.is_lightning():
return bool(self._lnaddr.get_fallback_address())
else:
return True
def get_expiration_date(self):
# 0 means never
return self.exp + self.time if self.exp else 0