aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/migrate.ts2
-rw-r--r--lib/nwc.ts3
-rw-r--r--lib/payments.ts13
-rw-r--r--lib/sockets.ts2
4 files changed, 16 insertions, 4 deletions
diff --git a/lib/migrate.ts b/lib/migrate.ts
index 403e22b1..8da68cd2 100644
--- a/lib/migrate.ts
+++ b/lib/migrate.ts
@@ -12,7 +12,7 @@ async function migrate(id) {
let user = await g(`user:${id}`);
if (typeof user === "string") user = await g(`user:${user}`);
- if (user) return user;
+ return user;
user = await ga(`user:${id}`);
diff --git a/lib/nwc.ts b/lib/nwc.ts
index 912a2fc3..73b7decd 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -76,7 +76,8 @@ export default () => {
} catch (e) {
err(
"problem with nwc",
- user.username,
+ pubkey,
+ user?.username,
JSON.stringify(params),
e.message,
);
diff --git a/lib/payments.ts b/lib/payments.ts
index 1468a198..af16e02e 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -54,8 +54,19 @@ export const debit = async ({
rate = undefined,
}) => {
amount = parseInt(amount);
- if (type !== types.internal && (await g("freeze")))
+ let blacklisted = await db.sIsMember("blacklist", user?.username?.toLowerCase());
+ let whitelisted = await db.sIsMember("whitelist", user?.username?.toLowerCase());
+
+ if (type !== types.internal && blacklisted && !whitelisted && amount > 500) {
+ warn("Blocking payment", amount, hash, user.username, user.id);
+ fail("Problem sending payment");
+ }
+
+ if (type !== types.internal && (await g("freeze")) && amount > 1000000 && !whitelisted) {
+ warn("Blocking payment", amount, hash, user.username, user.id);
fail("Problem sending payment");
+ }
+
// if (!user.unlimited && amount > 1000000)
// fail(`⚡️${amount} exceeds max withdrawal of ⚡️1,000,000`);
let ref;
diff --git a/lib/sockets.ts b/lib/sockets.ts
index 1a5421f9..028551ed 100644
--- a/lib/sockets.ts
+++ b/lib/sockets.ts
@@ -121,7 +121,7 @@ Bun.serve({
subscriptions.push({ invoice: data, ws });
break;
default:
- warn("received socket message of unknown type", type, data);
+ // warn("received socket message of unknown type", type, data);
}
},
open(ws: any) {