aboutsummaryrefslogtreecommitdiffstats
path: root/names/server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-05 21:38:09 -0700
committerAdam Soltys <[email protected]>2026-09-05 21:38:09 -0700
commit5de0ef4232270b8b0d67b2c001b62fa316c939a2 (patch)
tree762232d0022fe3f938e29ed09dceba3ca9aebd2a /names/server.js
parent28c66df5abbcfd0c5952148772b0219195016733 (diff)
downloadcoinosv3-server-5de0ef4232270b8b0d67b2c001b62fa316c939a2.tar.gz
coinosv3-server-5de0ef4232270b8b0d67b2c001b62fa316c939a2.zip
Payment push notifications are scoped to their network, so a mainnet payment stops opening the staging PWA. The same seed derives the same nostr pubkey on mainnet and staging, so both PWAs registered push under one pubkey and the notifier — matching only by pubkey — fanned every mainnet payment out to the staging subscription too; tapping it opened staging.coinos.io. Now the client stamps its network on the push registration (pushWatch net: getNetwork()), the registrar declares its own network on the /notify call (CFG.forwarder.network), and nwcpush delivers a payment only to registrations whose net matches — with a rollout-safe fallback: a device that hasn't re-registered yet (net=null) still gets the push, and a caller that omits net still reaches everyone, so nobody goes dark mid-deploy. Deployed names + nwcpush on cs
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MGzU12QrAA4G6BYGzGVdXz
Diffstat (limited to 'names/server.js')
-rw-r--r--names/server.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/names/server.js b/names/server.js
index 6588108..971108c 100644
--- a/names/server.js
+++ b/names/server.js
@@ -520,7 +520,9 @@ async function settleLoop() {
if (CFG.push && CFG.push.url && state.names[name]) {
fetch(`${CFG.push.url}/notify`, {
method: 'POST', headers: { 'content-type': 'application/json' },
- body: JSON.stringify({ token: CFG.push.token, pubkey: state.names[name].pubkey, amountSat: sat }),
+ // this registrar's own network, so the notifier delivers only to the
+ // payee's devices on it (a seed makes the same pubkey on both nets)
+ body: JSON.stringify({ token: CFG.push.token, pubkey: state.names[name].pubkey, amountSat: sat, net: CFG.forwarder?.network || 'mainnet' }),
}).catch(() => {});
}
// ...and POST to their webhook, if they registered one