aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-17 11:34:53 -0700
committerAdam Soltys <[email protected]>2024-10-17 11:34:53 -0700
commitdd52d07a513c4c98197b36eb48e213a0b2164d32 (patch)
tree645a4a185585093c4ce8b61e9e4cad126226bdb5 /lib
parent70d752642c7faa786f45e90c2afaf348efe4310d (diff)
downloadcoinos-server-dd52d07a513c4c98197b36eb48e213a0b2164d32.tar.gz
coinos-server-dd52d07a513c4c98197b36eb48e213a0b2164d32.zip
rm payment from list
Diffstat (limited to 'lib')
-rw-r--r--lib/db.ts7
-rw-r--r--lib/payments.ts2
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/db.ts b/lib/db.ts
index 82fa2cec..50c78e85 100644
--- a/lib/db.ts
+++ b/lib/db.ts
@@ -32,6 +32,8 @@ local paymentKey = KEYS[1]
local balanceKey = KEYS[2]
local creditKey = KEYS[3]
local hashKey = KEYS[4]
+local paymentsKey = KEYS[5]
+local pid = KEYS[6]
local total = tonumber(ARGV[1])
local credit = tonumber(ARGV[2])
@@ -43,9 +45,10 @@ if payment ~= nil then
redis.call('incrby', creditKey, credit)
redis.call('del', paymentKey)
redis.call('del', hashKey)
+ redis.call('lrem', paymentsKey, 0, pid);
end
-return paymentKey
+return pid
`;
let debit = defineScript({
@@ -55,7 +58,7 @@ let debit = defineScript({
});
let reverse = defineScript({
- NUMBER_OF_KEYS: 4,
+ NUMBER_OF_KEYS: 6,
SCRIPT: REVERSE,
transformArguments: (...args) => args.map((a) => a.toString()),
});
diff --git a/lib/payments.ts b/lib/payments.ts
index 1f1497ec..cc55e5ce 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -818,6 +818,8 @@ let reverse = async (p) => {
`balance:${p.uid}`,
`credit:${types.lightning}:${p.uid}`,
`payment:${p.hash}`,
+ `${p.uid}:payments`,
+ p.id,
total,
credit,
);