Skip to content

fix: warn on the fee band, not on one reading of it - #7

Merged
TheCryptoDonkey merged 2 commits into
mainfrom
fix/mint-fee-band-warnings
Aug 21, 2026
Merged

fix: warn on the fee band, not on one reading of it#7
TheCryptoDonkey merged 2 commits into
mainfrom
fix/mint-fee-band-warnings

Conversation

@TheCryptoDonkey

Copy link
Copy Markdown
Member

Blocked on lnurlcash-kit 0.1.2 (mintFeeBand, merged as lnurlcash/lnurlcash-kit#3 but not yet released) and forgesworn/moneyer#2 for the test's rounding mint. CI will fail until both are on npm.

What went wrong on the live run

The first real inter-mint transfer warned twice about a mint that had done exactly what it documents. 40,000 msat to mint.forgesworn.dev credited 38,000, and the wallet said:

warning: the note URL claims 38960 msat but the mint says 38000 msat - the mint is authoritative
warning: expected 38960 msat net but the mint credited 38000 msat

dni's lnurl-mint ceilings its fee to a whole sat on purpose; moneyer is msat-exact; LUD-25 says nothing either way. A single predicted number is therefore wrong about one of the two live implementations, and telling a holder their mint short-changed them when it did not is worse than saying nothing — it teaches them to ignore the warning that matters.

The fix

Predicts the band. expectedNetMsat stays the generous edge, minNetMsat is the ceilinged one, and a warning fires only outside them, naming the range.

The second warning was our own doing: claimMint built the note URL with its own guess, then receive() compared that guess against the mint. Where the band is not a point we do not know what the note is worth, so the URL declares nothing and lets the mint answer — which is what buildNoteUrl's optional amount is for.

minNetMsat is optional: records written before this exist, and for them the band is a point.

Tests

Four at the wallet level covering both edges and a msat outside each, using the numbers mint.forgesworn.dev actually credited, plus an integration test driving a real transfer into a rounding mint and asserting silence. 70 green locally against the merged kit.

The first live transfer warned twice about a mint that had done exactly
what it documents. 40,000 msat to mint.forgesworn.dev credited 38,000,
and the wallet said "expected 38960 msat net but the mint credited 38000"
and "the note URL claims 38960 msat but the mint says 38000".

dni's lnurl-mint ceilings its fee to a whole sat on purpose; moneyer is
msat-exact; LUD-25 says nothing either way. So a single predicted number
is wrong about one of the two live implementations, and telling a holder
their mint short-changed them when it did not is worse than saying
nothing - it teaches them to ignore the warning that matters.

Predicts the band instead. expectedNetMsat stays the generous edge and
minNetMsat is the ceilinged one, and a warning fires only outside them,
naming the range.

The second warning was our own doing: claimMint built the note URL with
its guess, then receive() compared that guess against the mint. Where the
band is not a point we do not know what the note is worth, so the URL now
declares nothing and lets the mint answer, which is what buildNoteUrl's
optional amount is for.

minNetMsat is optional: records written before this exist, and for them
the band is a point.
The band lives in the kit as of 0.1.2, and the transfer test needs a mint
that can ceiling its fee the way the reference does, which moneyer gained
in 0.1.2.
@TheCryptoDonkey
TheCryptoDonkey merged commit 72ed1b5 into main Aug 21, 2026
2 checks passed
@TheCryptoDonkey
TheCryptoDonkey deleted the fix/mint-fee-band-warnings branch August 21, 2026 13:10
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