aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-15 22:49:17 +0000
committerAdam Soltys <[email protected]>2026-03-15 22:49:17 +0000
commit74af7b1d0922e740c0358dfd131776fd7c877767 (patch)
treee1e8e0cf566c1de7b48863ec6d0790b5632b2e71 /lib
parentf87b082c14869c4934b4e5fc7ff4b8066a84ed8d (diff)
downloadcoinos-server-74af7b1d0922e740c0358dfd131776fd7c877767.tar.gz
coinos-server-74af7b1d0922e740c0358dfd131776fd7c877767.zip
adjust ln minfeeregtest-data
Diffstat (limited to 'lib')
-rw-r--r--lib/app.ts1
-rw-r--r--lib/health.ts10
-rw-r--r--lib/ln.ts2
-rw-r--r--lib/nwc.ts10
-rw-r--r--lib/payments.ts9
5 files changed, 13 insertions, 19 deletions
diff --git a/lib/app.ts b/lib/app.ts
index 7632520f..a1a31291 100644
--- a/lib/app.ts
+++ b/lib/app.ts
@@ -118,6 +118,7 @@ app.register(fastifyProxy, {
prefix: "/ws",
rewritePrefix: "/ws",
websocket: true,
+ disableRequestLogging: true,
});
app.register(fastifySecureSession, {
diff --git a/lib/health.ts b/lib/health.ts
index c2e268c6..d9c38fa5 100644
--- a/lib/health.ts
+++ b/lib/health.ts
@@ -37,7 +37,7 @@ async function checkLightningHealth(): Promise<boolean> {
const startTime = Date.now();
try {
- l("health check: testing lightning connection...");
+ // l("health check: testing lightning connection...");
const info = await withTimeout(ln.getinfo(), RPC_TIMEOUT, "getinfo");
if (!info?.id) {
@@ -71,7 +71,7 @@ async function checkLightningHealth(): Promise<boolean> {
}
const duration = Date.now() - startTime;
- l(`health check: passed in ${duration}ms, node: ${info.id.slice(0, 16)}...`);
+ // l(`health check: passed in ${duration}ms, node: ${info.id.slice(0, 16)}...`);
return true;
} catch (e: any) {
@@ -139,9 +139,9 @@ 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})`,
- );
+ // 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/ln.ts b/lib/ln.ts
index 4dff06af..a1e4bd5c 100644
--- a/lib/ln.ts
+++ b/lib/ln.ts
@@ -123,7 +123,7 @@ export default ln;
// Dedicated proxy for long-polling (waitanyinvoice) — uses its own socket
// so it doesn't block the main connection
-export const lnListen = lightningProxy(config.lightning);
+export const lnListen = lightningProxy(config.lightningListen || config.lightning);
export const lnb = lightningProxy(config.lightningb);
export { LightningUnavailableError };
diff --git a/lib/nwc.ts b/lib/nwc.ts
index c888ee55..facf9dc8 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -185,14 +185,6 @@ const handle = (method, params, ev, app, user) =>
);
if (!created) {
- warn(
- "old nwc token",
- pubkey,
- user?.username,
- spent,
- amount,
- max_amount,
- );
return error({
code: "UNAUTHORIZED",
message: `This NWC connection is no longer valid please create a new one at https://coinos.io/settings/nostr`,
@@ -334,7 +326,7 @@ const handle = (method, params, ev, app, user) =>
async make_invoice() {
const { amount, description, description_hash, expiry } = params;
- l("nwc make_invoice", user.username);
+ // l("nwc make_invoice", user.username);
const invoice = {
amount: Math.round(amount / 1000),
diff --git a/lib/payments.ts b/lib/payments.ts
index 53b8dec1..151d4c99 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -309,7 +309,6 @@ export const completePayment = async (inv, p, user) => {
};
}
} catch (e) {
- console.log(e);
withdrawal = { failed: true };
warn(username, "autowithdraw failed", e.message);
}
@@ -543,11 +542,12 @@ export const sendLightning = async ({
payee = invoice_node_id;
}
- let minfee = 2;
+ const amt = amount_msat ? Math.round(amount_msat / 1000) : amount;
+ let minfee = Math.max(5, Math.round(amt * 0.005));
const { channels } = await ln.listpeerchannels();
if (channels.some((c) => c.peer_id === payee)) minfee = 0;
- fee = Math.max(Number.parseInt(fee || 0), minfee);
+ fee = Math.max(Number.parseInt(fee) || minfee, minfee);
if (fee < 0) fail("Fee cannot be negative");
const { pays } = await ln.listpays(pr);
@@ -576,7 +576,8 @@ export const sendLightning = async ({
// bolt11: pr.replace(/\s/g, "").toLowerCase(),
amount_msat: amount_msat ? undefined : amount * 1000,
maxfee: fee * 1000,
- retry_for: 10,
+ retry_for: 30,
+ layers: ["prefer-kappa"],
});
try {