From 4a8d7f9f43d423eeaa821d0bf5e6e18305692482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 6 Mar 2023 09:40:54 +0100 Subject: [PATCH] do not scrub yourself --- tasks.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks.py b/tasks.py index 26249bb..fea8a77 100644 --- a/tasks.py +++ b/tasks.py @@ -10,6 +10,7 @@ from lnbits import bolt11 from lnbits.core.models import Payment from lnbits.core.services import pay_invoice +from lnbits.core.crud import get_standalone_payment from lnbits.helpers import get_current_extension_name from lnbits.tasks import register_invoice_listener @@ -69,6 +70,12 @@ async def on_invoice_paid(payment: Payment): invoice = bolt11.decode(params["pr"]) + lnurlp_payment = await get_standalone_payment(invoice.payment_hash) + # (avoid loops) + # do not scrub yourself! :) + if lnurlp_payment and lnurlp_payment.wallet_id == payment.wallet_id: + return + if invoice.amount_msat != rounded_amount: raise HTTPException( status_code=HTTPStatus.BAD_REQUEST,