From 8e5395b7294e126fc54ef918ee16cf0036dd0089 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 20 Feb 2025 18:56:42 +0000 Subject: handle no budget --- lib/nwc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/nwc.ts b/lib/nwc.ts index 210639e0..7039dc62 100644 --- a/lib/nwc.ts +++ b/lib/nwc.ts @@ -132,7 +132,7 @@ const handle = (method, params, ev, app, user) => ); const whitelisted = await db.sIsMember("activeNwc", pubkey); - if ((amount > 1000 && !(whitelisted || created)) || spent + amount > max_amount) { + if ((amount > 1000 && !(whitelisted || created)) || (max_amount > 0 && (spent + amount > max_amount))) { warn("budget exceeded", pubkey, user?.username, spent, amount, max_amount); return error({ code: "QUOTA_EXCEEDED", -- cgit v1.2.3