Browse Source

fix receiving lightning requests without amount

patch-4
ThomasV 3 years ago
parent
commit
8354dd006b
  1. 6
      electrum/lnworker.py

6
electrum/lnworker.py

@ -1789,6 +1789,7 @@ class LNWallet(LNWorker):
write_to_disk: bool = True,
) -> Tuple[LnAddr, str]:
assert amount_msat is None or amount_msat > 0
timestamp = int(time.time())
routing_hints = self.calc_routing_hints_for_invoice(amount_msat)
if not routing_hints:
@ -1831,7 +1832,7 @@ class LNWallet(LNWorker):
def add_request(self, amount_sat: Optional[int], message:str, expiry: int, fallback_address:str) -> str:
# passed expiry is relative, it is absolute in the lightning invoice
amount_msat = amount_sat * 1000 if amount_sat is not None else None
amount_msat = amount_sat * 1000 if amount_sat else None
timestamp = int(time.time())
lnaddr, invoice = self.create_invoice(
amount_msat=amount_msat,
@ -1932,7 +1933,8 @@ class LNWallet(LNWorker):
return
if info is None and status == PR_SCHEDULED:
# we should add a htlc to our ctx, so that the funds are 'reserved'
info = PaymentInfo(payment_hash, 0, SENT, PR_SCHEDULED)
# Note: info.amount will be added by pay_invoice
info = PaymentInfo(payment_hash, None, SENT, PR_SCHEDULED)
info = info._replace(status=status)
self.save_payment_info(info)

Loading…
Cancel
Save