mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-07 19:38:13 +02:00
Core: fix internal webhooks (#649)
* fix internal webhooks * argument annotation
This commit is contained in:
parent
b03da7b9c2
commit
906f0166bd
@ -180,13 +180,18 @@ async def get_wallet_for_key(
|
||||
|
||||
|
||||
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]:
|
||||
clause: str = "checking_id = ? OR hash = ?"
|
||||
if incoming:
|
||||
clause = f"({clause}) AND amount > 0"
|
||||
row = await (conn or db).fetchone(
|
||||
"""
|
||||
f"""
|
||||
SELECT *
|
||||
FROM apipayments
|
||||
WHERE checking_id = ? OR hash = ?
|
||||
WHERE {clause}
|
||||
LIMIT 1
|
||||
""",
|
||||
(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):
|
||||
payment = await get_standalone_payment(checking_id)
|
||||
payment = await get_standalone_payment(checking_id, incoming=True)
|
||||
if payment and payment.is_in:
|
||||
await payment.set_pending(False)
|
||||
for send_chan in invoice_listeners:
|
||||
|
Loading…
x
Reference in New Issue
Block a user