mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-01 19:11:17 +02:00
Core: fix internal webhooks (#649)
* fix internal webhooks * argument annotation
This commit is contained in:
@ -180,13 +180,18 @@ async def get_wallet_for_key(
|
|||||||
|
|
||||||
|
|
||||||
async def get_standalone_payment(
|
async def get_standalone_payment(
|
||||||
checking_id_or_hash: str, conn: Optional[Connection] = None
|
checking_id_or_hash: str,
|
||||||
|
conn: Optional[Connection] = None,
|
||||||
|
incoming: Optional[bool] = False,
|
||||||
) -> Optional[Payment]:
|
) -> Optional[Payment]:
|
||||||
|
clause: str = "checking_id = ? OR hash = ?"
|
||||||
|
if incoming:
|
||||||
|
clause = f"({clause}) AND amount > 0"
|
||||||
row = await (conn or db).fetchone(
|
row = await (conn or db).fetchone(
|
||||||
"""
|
f"""
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM apipayments
|
FROM apipayments
|
||||||
WHERE checking_id = ? OR hash = ?
|
WHERE {clause}
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
""",
|
""",
|
||||||
(checking_id_or_hash, checking_id_or_hash),
|
(checking_id_or_hash, checking_id_or_hash),
|
||||||
|
@ -114,7 +114,7 @@ async def perform_balance_checks():
|
|||||||
|
|
||||||
|
|
||||||
async def invoice_callback_dispatcher(checking_id: str):
|
async def invoice_callback_dispatcher(checking_id: str):
|
||||||
payment = await get_standalone_payment(checking_id)
|
payment = await get_standalone_payment(checking_id, incoming=True)
|
||||||
if payment and payment.is_in:
|
if payment and payment.is_in:
|
||||||
await payment.set_pending(False)
|
await payment.set_pending(False)
|
||||||
for send_chan in invoice_listeners:
|
for send_chan in invoice_listeners:
|
||||||
|
Reference in New Issue
Block a user