aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-16 16:49:41 -0700
committerAdam Soltys <[email protected]>2026-03-16 16:49:41 -0700
commit988b7c1b028f0528433acc36a54a4a3c514108e3 (patch)
tree655c05c0fc7c465c57df5fa12028155c762a1681 /lib
parent8c1385eaf8e68ef0ad436ad9b74e5813e92bb378 (diff)
downloadcoinos-server-988b7c1b028f0528433acc36a54a4a3c514108e3.tar.gz
coinos-server-988b7c1b028f0528433acc36a54a4a3c514108e3.zip
quieter logs
Diffstat (limited to 'lib')
-rw-r--r--lib/ark.ts4
-rw-r--r--lib/dmNotifications.ts4
-rw-r--r--lib/health.ts3
-rw-r--r--lib/mls.ts3
-rw-r--r--lib/payments.ts36
-rw-r--r--lib/zmq.ts25
6 files changed, 40 insertions, 35 deletions
diff --git a/lib/ark.ts b/lib/ark.ts
index d24b0bc1..f4f6d70d 100644
--- a/lib/ark.ts
+++ b/lib/ark.ts
@@ -185,8 +185,8 @@ export const refreshArkWallet = async (force = false) => {
};
// Initial check after 60s startup delay; retry every 60s to catch ark rounds
-setTimeout(refreshArkWallet, 300_000);
-setInterval(() => refreshArkWallet(), 300_000);
+setTimeout(refreshArkWallet, 60_000);
+setInterval(() => refreshArkWallet(), 60_000);
export const sendArk = async (address: string, amount: number) => {
diff --git a/lib/dmNotifications.ts b/lib/dmNotifications.ts
index 161920d8..612a0ce8 100644
--- a/lib/dmNotifications.ts
+++ b/lib/dmNotifications.ts
@@ -101,7 +101,7 @@ const subscribeGroupRelay = (url: string) => {
{ onevent: handleGroupMessage },
);
groupRelaySubs.push(() => sub.close());
- l(`listening for group messages on ${url}`);
+ // l(`listening for group messages on ${url}`);
})
.catch((e) => {
warn(`group listener failed ${url}`, e.message);
@@ -130,7 +130,7 @@ const subscribeInviteRelay = (url: string) => {
relay.subscribe([{ kinds: [1059], since: Math.floor(Date.now() / 1000) }], {
onevent: handleInviteEvent,
});
- l(`listening for invites on ${url}`);
+ // l(`listening for invites on ${url}`);
})
.catch((e) => {
warn(`invite listener failed ${url}`, e.message);
diff --git a/lib/health.ts b/lib/health.ts
index 0502748f..9df90a46 100644
--- a/lib/health.ts
+++ b/lib/health.ts
@@ -134,9 +134,6 @@ export async function runHealthCheck() {
}
export function startHealthCheck() {
- l(
- `health check: starting (interval=${HEALTH_CHECK_INTERVAL / 1000}s, timeout=${RPC_TIMEOUT / 1000}s, max_failures=${MAX_CONSECUTIVE_FAILURES})`,
- );
// Run first check after a delay to let the app initialize
checkTimer = setTimeout(runHealthCheck, 30000);
}
diff --git a/lib/mls.ts b/lib/mls.ts
index 8467b1ba..9e3d5d35 100644
--- a/lib/mls.ts
+++ b/lib/mls.ts
@@ -84,8 +84,6 @@ async function backfill(): Promise<void> {
const oldest = Math.min(...events.map((e) => e.created_at));
if (oldest <= threeWeeksAgo) break;
until = oldest;
-
- l(`mls backfill pass ${pass}: ${knownPubkeys.size} users, oldest ${new Date(oldest * 1000).toISOString()}`);
}
l(`mls backfill complete: ${knownPubkeys.size} users`);
@@ -110,7 +108,6 @@ export async function initMlsIndex(): Promise<void> {
try {
const existing = await db.hGetAll(MLS_KEY);
for (const pk of Object.keys(existing)) knownPubkeys.add(pk);
- l(`mls index loaded: ${knownPubkeys.size} users`);
} catch {}
// Subscribe for new key packages
diff --git a/lib/payments.ts b/lib/payments.ts
index 5650dda4..2737f886 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -1731,24 +1731,28 @@ export const reverse = async (p) => {
};
const freezeCheck = async () => {
- const funds = await ln.listfunds();
- const lnbalance = Math.round(funds.channels.reduce((a, b) => a + b.our_amount_msat, 0) / 1000);
-
- const bcbalance = Math.round((await bc.getBalance()) * SATS);
- const { bitcoin } = await lq.getBalance();
- const lqbalance = Math.round(bitcoin * SATS);
-
- const lnthreshold = await g("lightning:threshold");
- const bcthreshold = await g("bitcoin:threshold");
- const lqthreshold = await g("liquid:threshold");
+ try {
+ const funds = await ln.listfunds();
+ const lnbalance = Math.round(funds.channels.reduce((a, b) => a + b.our_amount_msat, 0) / 1000);
+ const lnthreshold = await g("lightning:threshold");
+ await s("lightning:limit", Math.max(lnbalance - lnthreshold, 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));
+ } catch {}
- await s("lightning:limit", Math.max(lnbalance - lnthreshold, 0));
- await s("bitcoin:limit", Math.max(bcbalance - bcthreshold, 0));
- await s("liquid:limit", Math.max(lqbalance - lqthreshold, 0));
+ try {
+ const bcbalance = Math.round((await bc.getBalance()) * SATS);
+ const bcthreshold = await g("bitcoin:threshold");
+ await s("bitcoin:limit", Math.max(bcbalance - bcthreshold, 0));
+ } catch {}
- 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));
+ try {
+ const { bitcoin } = await lq.getBalance();
+ const lqbalance = Math.round(bitcoin * SATS);
+ const lqthreshold = await g("liquid:threshold");
+ await s("liquid:limit", Math.max(lqbalance - lqthreshold, 0));
+ } catch {}
const arkBalance = getArkBalance();
if (arkBalance) {
diff --git a/lib/zmq.ts b/lib/zmq.ts
index c584a41d..d0e1d05f 100644
--- a/lib/zmq.ts
+++ b/lib/zmq.ts
@@ -226,31 +226,38 @@ const startSub = (url: string, topic: string, onMessage: (b: Uint8Array) => void
buffer = concatBytes(buffer, d as Uint8Array) as any;
processBuffer().catch((e) => err("zmq parse error", e.message));
});
- socket.on("error", (e) => {
+ socket.on("error", () => {
if (closed) return;
closed = true;
- warn("zmq socket error", e.message);
resolve();
});
socket.on("close", () => {
if (closed) return;
closed = true;
- warn("zmq socket closed", url);
resolve();
});
});
export const startZmq = async () => {
if (process.env.DISABLE_ZMQ === "1") return;
- l("zmq connecting", RAWTX_URL, RAWBLOCK_URL);
const retry = async (url: string, topic: string, handler: (b: Uint8Array) => Promise<void>) => {
- let delay = 1000;
- const maxDelay = 30000;
+ let delay = 5000;
+ const maxDelay = 60000;
+ let failing = false;
while (true) {
- await startSub(url, topic, (raw) =>
- handler(raw).catch((e) => warn(`${topic} error`, e.message)),
- );
+ await startSub(url, topic, (raw) => {
+ if (failing) {
+ l("zmq reconnected", topic, url);
+ failing = false;
+ delay = 5000;
+ }
+ handler(raw).catch((e) => warn(`${topic} error`, e.message));
+ });
+ if (!failing) {
+ warn("zmq disconnected, retrying", topic, url);
+ failing = true;
+ }
await new Promise((r) => setTimeout(r, delay));
delay = Math.min(maxDelay, Math.floor(delay * 1.5));
}