From f502a78a29c41bfb0c842bbc061a51b7c6b105e5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 12 May 2023 10:25:07 -0700 Subject: fix failed payment reversal --- routes/payments.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'routes') diff --git a/routes/payments.js b/routes/payments.js index 874ed6e1..887d01ff 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -94,10 +94,10 @@ export default { } catch (e) { warn("something went wrong", e.message); if (!(r && r.status === "complete")) { - let credit = Math.round(amount * config.fee) - p.ourfee; - await db.incrBy(`balance:${p.uid}`, amount + maxfee + p.ourfee); + let credit = Math.round(total * config.fee) - p.ourfee; + await db.incrBy(`balance:${p.uid}`, total + maxfee + p.ourfee); await db.incrBy(`credit:${types.lightning}:${p.uid}`, credit); - await db.lRem(`${p.uid}:payments`, 0, p.id); + await db.lRem(`${p.uid}:payments`, 1, p.id); await db.del(`payment:${p.id}`); } throw e; -- cgit v1.2.3