log errors on faulty lnpay webhooks.

This commit is contained in:
fiatjaf 2020-11-12 15:33:02 -03:00
parent a198842f50
commit a67b93108b

View File

@ -110,7 +110,11 @@ class LNPayWallet(Wallet):
async def webhook_listener(self):
text: str = await request.get_data()
data = json.loads(text)
try:
data = json.loads(text)
except json.decoder.JSONDecodeError:
print(f"got something wrong on lnpay webhook endpoint: {text[:200]}")
data = None
if type(data) is not dict or "event" not in data or data["event"].get("name") != "wallet_receive":
return "", HTTPStatus.NO_CONTENT