aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/nwc.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-03 16:18:01 -0700
committerAdam Soltys <[email protected]>2026-11-03 16:18:01 -0700
commit7e8f2b375aebd3809b6fe9c474c6a36b392163f2 (patch)
treee23a70eb0cee8f5b24f94d4925ee3a3da5911583 /src/features/nwc.js
parentc566edbe50a8921311127efac65836bd6ff9c6d3 (diff)
downloadcoinosv3-7e8f2b375aebd3809b6fe9c474c6a36b392163f2.tar.gz
coinosv3-7e8f2b375aebd3809b6fe9c474c6a36b392163f2.zip
A wallet on another ark server tells the registrar it is listening, so Lightning sent to its name arrives the moment it opens. A name whose wallet lives on Second (or a custom server) can only be paid over Lightning — the registrar's float can't arkoor to a server it isn't on — and only while the wallet is open to answer the registrar's offer request; its hourly retry with a six-second window rarely met a short phone session, and manna's 52 sats failed 449 times from 2026-10-18 to 11-03. Once the offer listener is up (nwc listen(), a beat after subscribing), the names feature POSTs /listening (NIP-98, coinosv3-server 14a6dd5) and the registrar sends whatever is queued for the name at once. Once per ten minutes, and never for a wallet on the coinos server: it is paid while asleep and spends no signature on this. tools/names-listening-test.js: nothing on coinos's server, one authed call on Second, no second within ten minutes, a registrar that is down is asked again next time
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6TFgisGKUDhdStLUvs
Diffstat (limited to 'src/features/nwc.js')
-rw-r--r--src/features/nwc.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/features/nwc.js b/src/features/nwc.js
index a2730f5..dc87388 100644
--- a/src/features/nwc.js
+++ b/src/features/nwc.js
@@ -671,6 +671,10 @@ export function nwcFeature(ctx) {
{ kinds: [OFFER_KIND], '#p': [o.pk], since: nowSec() - MAX_AGE_SEC },
(ev) => { onOfferRequest(ev).catch((e) => console.warn('nwc: offer handler', e.message)); },
));
+ // a beat for the subscription to reach the relays, then tell the
+ // registrar this wallet is here to answer: Lightning deliveries
+ // queued for a wallet on another ark server go out now (names)
+ setTimeout(() => { if (gen === listenGen) Promise.resolve(hook('namesListening')).catch(() => {}); }, 1500);
}
const list = [...conns(), ...revokedConns()];
dlog(`nwc: listen() gen ${gen} — ${list.length} connection(s)`);