Skip to content

fix: speak to older mints again, in forms every generation reads (0.25.1) - #104

Merged
TheCryptoDonkey merged 2 commits into
mainfrom
fix/old-mint-compat
Oct 6, 2026
Merged

TheCryptoDonkey merged 2 commits into
mainfrom
fix/old-mint-compat

Conversation

@TheCryptoDonkey

@TheCryptoDonkey TheCryptoDonkey commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

0.25.0 moved to @lnurlcash/kit 0.20.2, which speaks only LUD-25's renamed wire forms (?p=<cp1>, p1/p2, a cp1 quote comment). Mints from before the renames (the reference lnurl-mint, moneyer before 0.12) read none of those, so 0.25.0 could not look up, receive, check, rotate, split, merge, send, melt or mint a bearer note at one.

What changes

A bearer note goes on the wire in forms every mint generation reads. Nothing waits for a refusal and retries in another shape; the rule for when that would be allowed is written down in src/lnurlcash-network.ts.

  • Lookup (receive, check, probe, reconcile, the mint-claim poll): the note's own ?k1=, which every mint answers (a current one checks the spend in full).
  • Rotate / split / merge: each output's 64-hex h under both p1 and h (p2 and h2). An old mint reads h and ignores p1; moneyer 0.12+ reads either and requires them to agree. The merge batcher counts both names.
  • Mint quote: the hash as both comment and h. A mint that binds only by h (advertising mintToHash, no commentAllowed) can be added again, and must confirm mintToHash on the quote or the invoice is dropped unshown.
  • Melt: unchanged (k1, pr).
  • Restore: unchanged. An old mint has no secret-free lookup, so it still needs allowSecretDisclosure, as designed.
  • Certificates: an older mint certifies only over a bearer note's h, as hex or fixed-HRP cs1 (sig/sig2). 0.25.0 refused every certified note from one once its key was pinned, and could never take one offline. For a 64-hex k1 these now verify under the rule they were made under, rotates keep them, and they are sent as sig= beside amount=. On a ck1/cw1 they still verify nowhere. This reverses that part of 0.25.0's changelog.
  • Key-path and script-path notes (ck1, cw1) exist only at current mints and stay on the kit's forms.

Tests

test/old-mints.test.ts grades every bearer-note operation against moneyer 0.17, moneyer 0.3.1 (moneyer-legacy, an npm alias) and lnurlcash-conformance 0.13.1's mock mint (lnurlcash-conformance-0-13). All three run in process, with no real mints and no sats. On main, all 23 old-mint cases fail (and the 6 updated unit and integration tests too) (lookups NoteUnknownError, mutations missing h, a 0.3.1 mint refused by addMint). On this branch all of them pass. The mock's invoices don't decode as BOLT-11, so the full mint flow there is graded at the wire only.

npm run check is green.

Kit 0.20 speaks only LUD-25's renamed wire forms, which mints from before
the renames (lnurl-mint, moneyer before 0.12) do not read, so 0.25.0 could
not look up, receive, check, rotate, split, merge, send, melt or mint a
bearer note at one.

A bearer note now goes on the wire in forms every generation reads: looked
up by its own ?k1=, each mutation output's 64-hex h under both p1 and h
(p2 and h2), a mint quote named as both comment and h, a melt as k1 and pr.
A current mint reads either name and requires them to agree. Key-path and
script-path notes stay on the kit's forms.

A mint that binds quotes only by h (advertising mintToHash) can be added
and minted at, provided it confirms mintToHash on the quote. An older
mint's certificate over a bearer note's h (hex, or the fixed-HRP cs1) is
verified under the rule it was made under, kept from a rotate's sig/sig2,
and sent as sig= beside amount=.

Graded against moneyer 0.17, moneyer 0.3.1 and the lnurlcash-conformance
0.13.1 mock mint, all in process.
@TheCryptoDonkey
TheCryptoDonkey merged commit ceb1010 into main Oct 6, 2026
2 checks passed
@TheCryptoDonkey
TheCryptoDonkey deleted the fix/old-mint-compat branch October 6, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant