aboutsummaryrefslogtreecommitdiffstats
path: root/names
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-20 01:55:55 -0700
committerAdam Soltys <[email protected]>2026-11-20 01:55:55 -0700
commit8ec9a1e70d7b43455c89768f27187f15d5983a38 (patch)
treedd5b9387672b212da2df7c5a27ba91a3fb505a6a /names
parent6efa593d210370339c23c7cc01caa69a8dc233a5 (diff)
downloadcoinosv3-server-8ec9a1e70d7b43455c89768f27187f15d5983a38.tar.gz
coinosv3-server-8ec9a1e70d7b43455c89768f27187f15d5983a38.zip
names restarts itself when the Lightning node's socket goes stale. "tried to zap pnk but it said names.coinos.io could not create an invoice" (Adam, 2026-11-20). bcln was recreated at 04:26Z; names has the node's socket file mounted, the mount kept pointing at the old file, and every @coinos.io LNURL invoice failed with ECONNREFUSED for four and a half hours until names was restarted by hand. The same thing cost 13 hours on 2026-11-11. The socket client now counts refused connections: after a minute of nothing but refusals (ten minutes if this process never reached the node, so a node that is down doesn't restart names in a loop) names logs it and exits, and docker's restart mounts the new socket. Only the mainnet node does this; the mutinynet one is left alone. New bridge/ln.test.js passes (4 checks), with the store and forget tests.
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6Upic5L6MMJzkTn8zg
Diffstat (limited to 'names')
-rw-r--r--names/server.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/names/server.js b/names/server.js
index 34aae77..4d7a81c 100644
--- a/names/server.js
+++ b/names/server.js
@@ -310,7 +310,16 @@ function usableInvoice(pr, sat, network = null) {
} catch { return false; }
}
-const ln = CFG.ln ? lnBackend(CFG.ln) : null;
+// The node's socket file is mounted into this container; when the node is
+// restarted the mount goes stale and every invoice fails until this process
+// is restarted too (2026-11-12, 2026-11-20). Exit and let docker do that.
+const ln = CFG.ln ? lnBackend({
+ ...CFG.ln,
+ onDead: (e) => {
+ console.error(`lightning socket dead for a minute (${e.message}); exiting so the restart mounts the new one`);
+ process.exit(1);
+ },
+}) : null;
// Optional mutinynet CLN — lets staging sell (play-money) hats. Nothing else
// uses it: names, offers and forwards remain mainnet affairs.
const lnMut = CFG.lnMut ? lnBackend(CFG.lnMut) : null;