Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed May 8, 2024
1 parent 671d03c commit ea1d8d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lnurl/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ async def execute_pay_request(
timeout=timeout or TIMEOUT,
)
res2.raise_for_status()
assert isinstance(res2, LnurlPayActionResponse), "Invalid response in execute_pay_request."
invoice = bolt11_decode(res2.pr)
pay_res = LnurlResponse.from_dict(res2.json())
assert isinstance(pay_res, LnurlPayActionResponse), "Invalid response in execute_pay_request."
invoice = bolt11_decode(pay_res.pr)
if invoice.amount_msat != int(msat):
raise LnurlResponseException(
f"{res.callback.host} returned an invalid invoice."
f"Excepted `{msat}` msat, got `{invoice.amount_msat}`."
)
return LnurlResponse.from_dict(res2.json())
return pay_res
except Exception as exc:
raise LnurlResponseException(str(exc))

Expand Down
1 change: 1 addition & 0 deletions lnurl/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class LnurlPayActionResponse(LnurlResponseModel):
pr: LightningInvoice
success_action: Optional[Union[MessageAction, UrlAction, AesAction]] = Field(None, alias="successAction")
routes: List[List[LnurlPayRouteHop]] = []
verify: Optional[str] = None


class LnurlWithdrawResponse(LnurlResponseModel):
Expand Down

0 comments on commit ea1d8d0

Please sign in to comment.