aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-05-12 10:25:07 -0700
committerAdam Soltys <[email protected]>2023-05-12 10:25:07 -0700
commitf502a78a29c41bfb0c842bbc061a51b7c6b105e5 (patch)
tree367df6cdb369e799693098d1ee65b9c11eb2fb16
parentb3b1f196023d88a5b352d6dea99b6745dede5125 (diff)
downloadcoinos-server-f502a78a29c41bfb0c842bbc061a51b7c6b105e5.tar.gz
coinos-server-f502a78a29c41bfb0c842bbc061a51b7c6b105e5.zip
fix failed payment reversal
-rw-r--r--routes/payments.js6
1 files changed, 3 insertions, 3 deletions
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;