From 4f8c04659fd6efe4912a1a79453b8f6ed0b6a652 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 2 Aug 2026 08:30:10 -0700 Subject: Only pay internally when the name is really a local account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses at our own domain used to have the domain stripped and get paid internally on the assumption that every one of them was ours. v3 payment addresses live at the same domain, so check the account exists first and otherwise leave the address intact — it then flows through the normal lightning-address path. Co-Authored-By: Claude Fable 5 --- src/lib/parse.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/lib/parse.ts') diff --git a/src/lib/parse.ts b/src/lib/parse.ts index f41fe78f..03cd0c3d 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -21,7 +21,16 @@ export default async (s, host, cookies) => { } if (t.startsWith("lightning:")) t = t.replace("lightning:", ""); - if (t.includes("@") && t.split("@").pop() === PUBLIC_DOMAIN) t = t.split("@")[0]; + // Our own domain is no longer only ours: coinos v3 payment addresses live + // here too and are paid over lightning like anyone else's. Only strip the + // domain (and pay internally) when the name really is a local account. + if (t.includes("@") && t.split("@").pop() === PUBLIC_DOMAIN) { + const name = t.split("@")[0]; + try { + const u = await get(`/users/${name}`); + if (u && !u.anon) t = name; + } catch (e) {} + } if (t.includes("@") && t.includes(".")) { try { t = await get(`/encode?address=${t}`); -- cgit v1.2.3