fix receiving lightning requests without amount
This commit is contained in:
@@ -1789,6 +1789,7 @@ class LNWallet(LNWorker):
|
|||||||
write_to_disk: bool = True,
|
write_to_disk: bool = True,
|
||||||
) -> Tuple[LnAddr, str]:
|
) -> Tuple[LnAddr, str]:
|
||||||
|
|
||||||
|
assert amount_msat is None or amount_msat > 0
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
routing_hints = self.calc_routing_hints_for_invoice(amount_msat)
|
routing_hints = self.calc_routing_hints_for_invoice(amount_msat)
|
||||||
if not routing_hints:
|
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:
|
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
|
# 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())
|
timestamp = int(time.time())
|
||||||
lnaddr, invoice = self.create_invoice(
|
lnaddr, invoice = self.create_invoice(
|
||||||
amount_msat=amount_msat,
|
amount_msat=amount_msat,
|
||||||
@@ -1932,7 +1933,8 @@ class LNWallet(LNWorker):
|
|||||||
return
|
return
|
||||||
if info is None and status == PR_SCHEDULED:
|
if info is None and status == PR_SCHEDULED:
|
||||||
# we should add a htlc to our ctx, so that the funds are 'reserved'
|
# 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)
|
info = info._replace(status=status)
|
||||||
self.save_payment_info(info)
|
self.save_payment_info(info)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user