refactor: only use one (direction) flag for identifying payment
This commit is contained in:
+1
-7
@@ -455,20 +455,14 @@ async def update_payment_extra(
|
||||
payment_hash: str,
|
||||
extra: dict,
|
||||
outgoing: bool = False,
|
||||
incoming: bool = False,
|
||||
conn: Optional[Connection] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Only update the `extra` field for the payment.
|
||||
Old values in the `extra` JSON object will be kept unless the new `extra` overwrites them.
|
||||
"""
|
||||
amount_clause = ""
|
||||
|
||||
if outgoing != incoming:
|
||||
if outgoing:
|
||||
amount_clause = "AND amount < 0"
|
||||
else:
|
||||
amount_clause = "AND amount > 0"
|
||||
amount_clause = "AND amount < 0" if outgoing else "AND amount > 0"
|
||||
|
||||
row = await (conn or db).fetchone(
|
||||
f"SELECT hash, extra from apipayments WHERE hash = ? {amount_clause}",
|
||||
|
||||
Reference in New Issue
Block a user