diff options
| author | Adam Soltys <[email protected]> | 2026-07-31 09:51:18 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-07-31 09:51:18 -0700 |
| commit | f012aec416849b942ebc822b76d916aa5f43c1dc (patch) | |
| tree | 4d4990a5702182355ef873e05ec985d96dfc51dc | |
| parent | ec42b8be8ec4ff697e72f765e023db9741f7adef (diff) | |
| download | coinos-server-f012aec416849b942ebc822b76d916aa5f43c1dc.tar.gz coinos-server-f012aec416849b942ebc822b76d916aa5f43c1dc.zip | |
mintdemux: present old (recovery) keysets as inactive
The old mint's keysets are redeem/melt-only — wallets must never mint or swap
into them. Force active:false in the merged /v1/keysets so mint.coinos.io
advertises a single active sat keyset (the new one) instead of two. The old mint
is panic-locked (mint/swap disabled) regardless; this fixes the client-facing
view a reviewer flagged.
| -rw-r--r-- | mintdemux.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mintdemux.ts b/mintdemux.ts index 4ae1a6fd..b205a39c 100644 --- a/mintdemux.ts +++ b/mintdemux.ts @@ -92,7 +92,13 @@ Bun.serve({ if (path === "/v1/keysets") { const [rn, ro] = await Promise.all([fetch(`${NEW}/v1/keysets`).then(r => r.json()).catch(() => ({})), fetch(`${OLD}/v1/keysets`).then(r => r.json()).catch(() => ({}))]); const seen = new Set<string>(); const keysets: any[] = []; - for (const k of [...((rn as any).keysets || []), ...((ro as any).keysets || [])]) { const id = String(k.id); if (!seen.has(id)) { seen.add(id); keysets.push(k); } } + // NEW mint keysets keep their flags. OLD (recovery) keysets are forced + // active:false — they're redeem/melt-only, so wallets never mint or swap + // into them. Prevents advertising two active "sat" keysets at + // mint.coinos.io (the old mint is panic-locked anyway; this is the + // client-facing view). + for (const k of ((rn as any).keysets || [])) { const id = String(k.id); if (!seen.has(id)) { seen.add(id); keysets.push(k); } } + for (const k of ((ro as any).keysets || [])) { const id = String(k.id); if (!seen.has(id)) { seen.add(id); keysets.push({ ...k, active: false }); } } return new Response(JSON.stringify({ keysets }), { headers: J }); } const km = path.match(/^\/v1\/keys\/(.+)$/); |
