diff --git a/lnbits/core/crud.py b/lnbits/core/crud.py index bed281110..b38a3d144 100644 --- a/lnbits/core/crud.py +++ b/lnbits/core/crud.py @@ -452,7 +452,7 @@ async def update_payment_details( async def update_payment_extra( - hash: str, + payment_hash: str, extra: dict, outgoing: bool = False, incoming: bool = False, @@ -472,7 +472,7 @@ async def update_payment_extra( row = await (conn or db).fetchone( f"SELECT hash, extra from apipayments WHERE hash = ? {amount_clause}", - (hash,), + (payment_hash,), ) if not row: return @@ -481,7 +481,7 @@ async def update_payment_extra( await (conn or db).execute( f"UPDATE apipayments SET extra = ? WHERE hash = ? {amount_clause} ", - (json.dumps(db_extra), hash), + (json.dumps(db_extra), payment_hash), ) diff --git a/lnbits/extensions/lnurlp/tasks.py b/lnbits/extensions/lnurlp/tasks.py index 72805603b..e243e1a4e 100644 --- a/lnbits/extensions/lnurlp/tasks.py +++ b/lnbits/extensions/lnurlp/tasks.py @@ -67,4 +67,6 @@ async def mark_webhook_sent( payment.extra["wh_message"] = reason_phrase payment.extra["wh_response"] = text - await update_payment_extra(payment.payment_hash, payment.extra) + await update_payment_extra( + payment_hash=payment.payment_hash, extra=payment.extra, incoming=True + ) diff --git a/lnbits/extensions/withdraw/lnurl.py b/lnbits/extensions/withdraw/lnurl.py index 48ccaf4a9..866404434 100644 --- a/lnbits/extensions/withdraw/lnurl.py +++ b/lnbits/extensions/withdraw/lnurl.py @@ -163,7 +163,7 @@ async def api_lnurl_callback( r: httpx.Response = await client.post(link.webhook_url, **kwargs) await update_payment_extra( - hash=payment_hash, + payment_hash=payment_hash, extra={ "wh_success": r.is_success, "wh_message": r.reason_phrase, @@ -177,8 +177,9 @@ async def api_lnurl_callback( "Caught exception when dispatching webhook url: " + str(exc) ) await update_payment_extra( - payment_hash, - {"wh_success": False, "wh_message": str(exc)}, + payment_hash=payment_hash, + extra={"wh_success": False, "wh_message": str(exc)}, + outgoing=True, ) return {"status": "OK"}