take extra care on check_internal()

This commit is contained in:
fiatjaf
2020-09-06 23:52:36 -03:00
committed by fiatjaf
parent a8e1aa3154
commit 487f082eb2

View File

@@ -284,7 +284,13 @@ def delete_payment(checking_id: str) -> None:
def check_internal(payment_hash: str) -> Optional[str]:
with open_db() as db:
row = db.fetchone("SELECT checking_id FROM apipayments WHERE hash = ?", (payment_hash,))
row = db.fetchone(
"""
SELECT checking_id FROM apipayments
WHERE hash = ? AND pending AND amount > 0
""",
(payment_hash,),
)
if not row:
return None
else: