diff options
| author | Adam Soltys <[email protected]> | 2026-08-04 11:56:26 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-04 11:56:26 -0700 |
| commit | e35c0af04fafd6e069d0d1e67664bcaed8c9c671 (patch) | |
| tree | f6b1630a3d68309b72039f8ce00ac348d9803bdd /routes | |
| parent | 103001c49da84f9cd6b6d8c6eb682550442dc8e5 (diff) | |
| download | coinos-server-e35c0af04fafd6e069d0d1e67664bcaed8c9c671.tar.gz coinos-server-e35c0af04fafd6e069d0d1e67664bcaed8c9c671.zip | |
lnurl: serve local accounts directly instead of deferring to v3 registrar
A recent change made this coinos.io lnurlp endpoint defer any
migrated-flagged account to the v3 names registrar and 404 when the
registrar didn't have the name. But registration stamps that flag on
essentially every account and never syncs names to the registrar, so
this broke lightning-address resolution for nearly all accounts.
The v3 registrar is the front for v3 accounts and falls back to this
endpoint, so this endpoint is the fallback target: it must serve its own
accounts directly and must not defer back (which also avoids a loop once
the registrar's fallback is live). Serve the local account; 404 only when
no local account exists.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Dpqu6wizYe1c1g4k5Gd8JK
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/lnurl.ts | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/routes/lnurl.ts b/routes/lnurl.ts index 58cea541..be4c2b73 100644 --- a/routes/lnurl.ts +++ b/routes/lnurl.ts @@ -69,25 +69,15 @@ export default { .toLowerCase(), ); - // Not one of ours — or migrated to coinos v3, where the name now lives. - // Either way the names registrar answers for it. Hand its response - // through unchanged: the callback it returns is absolute, so the payer - // talks to the registrar directly from here on. - if (!user || user.migrated) { - const name = username.toLowerCase().replace(/\s/g, ""); - try { - const r = await fetch( - `${NAMES_URL}/.well-known/lnurlp/${encodeURIComponent(name)}?domain=${host}`, - ); - if (r.ok) { - const body: any = await r.json(); - if (body?.tag === "payRequest") return res.send(body); - } - } catch (e) { - warn("names lookup failed for", name, (e as any).message); - } - fail(`User ${username} not found`); - } + // The v3 names registrar (v3.coinos.io) is the FRONT for v3 accounts and + // falls back to THIS coinos.io endpoint for anything it doesn't have. So + // this endpoint is the fallback target: it must serve its own accounts + // directly and must NOT defer back to the registrar — that inverts the + // fallback and loops once the registrar's fallback is live. (It also can't + // key off `migrated`: register.ts stamps that flag on essentially every + // account, and those names were never synced to the registrar.) Just serve + // the local account, and 404 only when there is no local account at all. + if (!user) fail(`User ${username} not found`); const { id: uid } = user; const metadata = JSON.stringify([ |
