break wait loop when payment fails

This commit is contained in:
Riccardo Balbo 2026-05-19 14:16:04 +00:00
commit bb94f38c2f
2 changed files with 39 additions and 0 deletions

View file

@ -114,6 +114,14 @@ async def _process_invoice(
payment_status = await check_transaction_status(wallet_id, payment_hash)
if payment_status.success:
break
if payment_status.failed:
return {
"error": {
"code": "PAYMENT_FAILED",
"message": "Payment failed.",
},
"in_budget": in_budget,
}
await asyncio.sleep(0.05)
if not payment_status:
raise Exception("Payment status not found")