File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44import httpx
55import shortuuid
6+ from bolt11 import decode as decode_bolt11
67from fastapi import APIRouter , Request
78from fastapi .responses import JSONResponse
89from lnbits .core .crud import update_payment
@@ -96,6 +97,16 @@ async def api_lnurl_callback(
9697 if not link .enabled :
9798 return LnurlErrorResponse (reason = "Withdraw link is disabled." )
9899
100+ bolt11 = decode_bolt11 (pr )
101+ if not bolt11 .amount_msat :
102+ return LnurlErrorResponse (reason = "0 amount invoices are not supported." )
103+
104+ if (
105+ link .min_withdrawable * 1000 > bolt11 .amount_msat
106+ or bolt11 .amount_msat > link .max_withdrawable * 1000
107+ ):
108+ return LnurlErrorResponse (reason = "Amount not within limits." )
109+
99110 if link .is_spent :
100111 return LnurlErrorResponse (reason = "withdraw is spent." )
101112
You can’t perform that action at this time.
0 commit comments