submarine swaps: do not set attempts parameter in pay_invoice
there is no reason to handle that differently.
This commit is contained in:
@@ -1474,7 +1474,7 @@ class LNWallet(LNWorker):
|
|||||||
async def pay_invoice(
|
async def pay_invoice(
|
||||||
self, invoice: str, *,
|
self, invoice: str, *,
|
||||||
amount_msat: int = None,
|
amount_msat: int = None,
|
||||||
attempts: int = None, # used only in unit tests (and for swaps?!)
|
attempts: int = None, # used only in unit tests
|
||||||
full_path: LNPaymentPath = None,
|
full_path: LNPaymentPath = None,
|
||||||
channels: Optional[Sequence[Channel]] = None,
|
channels: Optional[Sequence[Channel]] = None,
|
||||||
) -> Tuple[bool, List[HtlcLog]]:
|
) -> Tuple[bool, List[HtlcLog]]:
|
||||||
|
|||||||
@@ -835,13 +835,13 @@ class SwapManager(Logger):
|
|||||||
lightning_amount_sat=lightning_amount_sat)
|
lightning_amount_sat=lightning_amount_sat)
|
||||||
# initiate fee payment.
|
# initiate fee payment.
|
||||||
if fee_invoice:
|
if fee_invoice:
|
||||||
asyncio.ensure_future(self.lnworker.pay_invoice(fee_invoice, attempts=10))
|
asyncio.ensure_future(self.lnworker.pay_invoice(fee_invoice))
|
||||||
# we return if we detect funding
|
# we return if we detect funding
|
||||||
async def wait_for_funding(swap):
|
async def wait_for_funding(swap):
|
||||||
while swap.funding_txid is None:
|
while swap.funding_txid is None:
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
# initiate main payment
|
# initiate main payment
|
||||||
tasks = [asyncio.create_task(self.lnworker.pay_invoice(invoice, attempts=10, channels=channels)), asyncio.create_task(wait_for_funding(swap))]
|
tasks = [asyncio.create_task(self.lnworker.pay_invoice(invoice, channels=channels)), asyncio.create_task(wait_for_funding(swap))]
|
||||||
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||||
return swap.funding_txid
|
return swap.funding_txid
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user