fix: warn on the fee band, not on one reading of it - #7
Merged
Conversation
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.
This was referenced Aug 21, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.
expectedNetMsatstays the generous edge,minNetMsatis the ceilinged one, and a warning fires only outside them, naming the range.The second warning was our own doing:
claimMintbuilt the note URL with its own guess, thenreceive()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 whatbuildNoteUrl's optional amount is for.minNetMsatis 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.