adding bolt11 lib and removing bolt11.py from the codebase (#1817)

* add latest bolt11 lib

decode exception handling for create_payment
fix json response for decode
bugfix hexing description hash
improvement on bolt11 lib
update to bolt11 2.0.1
fix clnrest
* bolt 2.0.4
* refactor core/crud.py

* catch bolt11 erxception clnrest
This commit is contained in:
dni ⚡
2023-09-25 12:06:54 +02:00
committed by GitHub
parent bd1db0c919
commit 1646b087cf
11 changed files with 125 additions and 429 deletions
+1 -3
View File
@@ -1,5 +1,4 @@
import asyncio
import datetime
from http import HTTPStatus
from fastapi import APIRouter, HTTPException
@@ -26,8 +25,7 @@ async def api_public_payment_longpolling(payment_hash):
try:
invoice = bolt11.decode(payment.bolt11)
expiration = datetime.datetime.fromtimestamp(invoice.date + invoice.expiry)
if expiration < datetime.datetime.now():
if invoice.has_expired():
return {"status": "expired"}
except Exception:
raise HTTPException(