aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-05-17 23:49:22 -0700
committerAdam Soltys <[email protected]>2026-05-17 23:49:22 -0700
commitd5395a81e5475af3a41c2715f58cab6b487a5795 (patch)
tree2bf382e6dcaebbf2c78096883fab807df9395fc3
parent7f4bf4d886bd43f3b15f18e3c4f7c040892e9f73 (diff)
downloadcoinos-server-d5395a81e5475af3a41c2715f58cab6b487a5795.tar.gz
coinos-server-d5395a81e5475af3a41c2715f58cab6b487a5795.zip
fix lnurl description_hash mismatch when sender provides a comment
The bolt11 description_hash is computed from the metadata JSON, which was being constructed with the sender's `comment` substituted into text/plain. Wallets verify description_hash against the metadata they received in the lnurl-pay response, so injecting the comment into the hash made the verification fail — the invoice would settle but description_hash verification would reject it as inconsistent. Keep metadata canonical ("Paying user@host") so the description_hash the wallet receives matches what they verify against. The comment is still preserved as the human-readable memo on the invoice record. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
-rw-r--r--routes/lnurl.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/routes/lnurl.ts b/routes/lnurl.ts
index f4357ff2..6b4e5deb 100644
--- a/routes/lnurl.ts
+++ b/routes/lnurl.ts
@@ -97,9 +97,8 @@ export default {
let { username } = user;
username = username.replace(/\s/g, "").toLowerCase();
- const memo = comment ?? `Paying ${username}@${host}`;
let metadata = JSON.stringify([
- ["text/plain", memo],
+ ["text/plain", `Paying ${username}@${host}`],
["text/identifier", `${username}@${host}`],
]);
@@ -124,6 +123,11 @@ export default {
user,
});
+ if (comment) {
+ invoice.memo = comment;
+ await s(`invoice:${invoice.id}`, invoice);
+ }
+
return c.json({
pr: invoice.text,
routes: [],