From 03ed185aac1e86df0b77db706914e8c2662af005 Mon Sep 17 00:00:00 2001 From: benarc Date: Tue, 16 Nov 2021 02:53:16 +0000 Subject: [PATCH] Fixed lost bug --- lnbits/extensions/satsdice/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lnbits/extensions/satsdice/views.py b/lnbits/extensions/satsdice/views.py index 4e16db4f..dd71643d 100644 --- a/lnbits/extensions/satsdice/views.py +++ b/lnbits/extensions/satsdice/views.py @@ -73,6 +73,11 @@ async def displaywin( raise HTTPException( status_code=HTTPStatus.NOT_FOUND, detail="satsdice link does not exist." ) + if satsdiceLink.lost: + return satsdice_renderer().TemplateResponse( + "satsdice/error.html", + {"request": request, "link": satsdicelink.id, "paid": False, "lost": True}, + ) withdrawLink = await get_satsdice_withdraw(payment_hash) if withdrawLink: @@ -92,6 +97,7 @@ async def displaywin( chance = satsdicelink.chance status = await api_payment(payment_hash) if not rand < chance or not status["paid"]: + await update_satsdice_payment(payment_hash, lost=1) return satsdice_renderer().TemplateResponse( "satsdice/error.html", {"request": request, "link": satsdicelink.id, "paid": False, "lost": True},