async invoice listeners through webhooks: lnpay and opennode.

This commit is contained in:
fiatjaf
2020-10-04 12:04:49 -03:00
parent 74117ffc57
commit 2c92205703
4 changed files with 64 additions and 15 deletions
+4 -2
View File
@@ -1,5 +1,6 @@
import asyncio
from typing import Optional, List, Awaitable, Tuple, Callable
from http import HTTPStatus
from typing import Optional, Tuple, List, Callable, Awaitable
from quart import Quart, Request, g
from werkzeug.datastructures import Headers
@@ -52,7 +53,8 @@ def register_invoice_listener(ext_name: str, cb: Callable[[Payment], Awaitable[N
async def webhook_handler():
handler = getattr(WALLET, "webhook_listener", None)
if handler:
await handler()
return await handler()
return "", HTTPStatus.NO_CONTENT
async def invoice_listener(app):