aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-02-12 04:35:13 -0800
committerAdam Soltys <[email protected]>2025-02-12 04:35:43 -0800
commit22b09ab76e5d82c97e38597a7244edb76dff9989 (patch)
tree2d9ca7796d24b58e781ce93bae4043cfc3a743c1
parent3783b6fc63d67853ba9bb11bd40f1d967b846240 (diff)
downloadcoinos-server-22b09ab76e5d82c97e38597a7244edb76dff9989.tar.gz
coinos-server-22b09ab76e5d82c97e38597a7244edb76dff9989.zip
limits
-rw-r--r--lib/payments.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/payments.ts b/lib/payments.ts
index 2f21d765..ce8d2dd7 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -60,9 +60,10 @@ export const debit = async ({
);
if (
- (amount > (await g("withdrawallimit")) && !whitelisted) ||
- amount > (await g(`${type}:limit`)) ||
- (await g("hardfreeze"))
+ (await g("hardfreeze")) ||
+ ((await g("freeze")) && type !== types.internal) ||
+ (amount > (await g("limit")) && !whitelisted) ||
+ amount > (await g(`${type}:limit`))
) {
warn("Blocking", user.username, amount, hash, user.id);
fail("Problem sending payment");
@@ -877,7 +878,7 @@ const freezeCheck = async () => {
funds.channels.reduce((a, b) => a + b.our_amount_msat, 0) / 1000,
);
- const bcbalance = Math.round(await bc.getBalance()) * SATS;
+ const bcbalance = Math.round(await bc.getBalance() * SATS);
const { bitcoin } = await lq.getBalance();
const lqbalance = Math.round(bitcoin * SATS);
@@ -889,6 +890,10 @@ const freezeCheck = async () => {
await s("bitcoin:limit", Math.max(lqbalance - lqthreshold, 0));
await s("liquid:limit", Math.max(bcbalance - bcthreshold, 0));
+ await s("fund:limit", Math.max(lnbalance - lnthreshold, 0));
+ await s("ecash:limit", Math.max(lnbalance - lnthreshold, 0));
+ await s("bolt12:limit", Math.max(lnbalance - lnthreshold, 0));
+
setTimeout(freezeCheck, 10000);
};
freezeCheck();