Skip to content

Commit

Permalink
do not scrub yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Mar 6, 2023
1 parent 677ca88 commit 4a8d7f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4a8d7f9

Please sign in to comment.