fix: enforce order of payments (#2313)

* fix: enforce order of payments

* fix: do not return wallet by key if the wallet is deleted
This commit is contained in:
Vlad Stan
2024-03-12 15:31:40 +02:00
committed by GitHub
parent 54dec171f9
commit 65b8868c36
4 changed files with 6 additions and 8 deletions
+3 -1
View File
@@ -554,7 +554,8 @@ async def get_wallet_for_key(
row = await (conn or db).fetchone(
"""
SELECT *, COALESCE((SELECT balance FROM balances WHERE wallet = wallets.id), 0)
AS balance_msat FROM wallets WHERE adminkey = ? OR inkey = ?
AS balance_msat FROM wallets
WHERE (adminkey = ? OR inkey = ?) AND deleted = false
""",
(key, key),
)
@@ -602,6 +603,7 @@ async def get_standalone_payment(
SELECT *
FROM apipayments
WHERE {clause}
ORDER BY amount
LIMIT 1
""",
tuple(values),