From 0ba81ec719cd4807ca6e7275c0e14093543c2ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Thu, 14 Aug 2025 13:37:44 +0200 Subject: [PATCH] bug: propergate LnurlErrorResponse in lnurl service and dont checks for redundant `LnurlPayActionResponse` (#3314) --- lnbits/core/services/lnurl.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lnbits/core/services/lnurl.py b/lnbits/core/services/lnurl.py index 38b82bae..c193573d 100644 --- a/lnbits/core/services/lnurl.py +++ b/lnbits/core/services/lnurl.py @@ -1,4 +1,5 @@ from lnurl import ( + LnurlErrorResponse, LnurlPayActionResponse, LnurlPayResponse, LnurlResponseException, @@ -13,6 +14,8 @@ from lnbits.utils.exchange_rates import fiat_amount_as_satoshis async def get_pr_from_lnurl(lnurl: str, amount_msat: int) -> str: res = await handle(lnurl, user_agent=settings.user_agent, timeout=10) + if isinstance(res, LnurlErrorResponse): + raise LnurlResponseException(res.reason) if not isinstance(res, LnurlPayResponse): raise LnurlResponseException( "Invalid LNURL response. Expected LnurlPayResponse." @@ -23,10 +26,8 @@ async def get_pr_from_lnurl(lnurl: str, amount_msat: int) -> str: user_agent=settings.user_agent, timeout=10, ) - if not isinstance(res, LnurlPayActionResponse): - raise LnurlResponseException( - "Invalid LNURL pay response. Expected LnurlPayActionResponse." - ) + if isinstance(res2, LnurlErrorResponse): + raise LnurlResponseException(res2.reason) return res2.pr