Repository navigation
Conversation
|
I've assigned @tnull as a reviewer! |
When `Bolt12Payment::send` is given a quantity, the invoice request amount is the offer amount multiplied by that quantity, and that total is what the node ends up paying. The payment record, however, stored only the per-item offer amount, and nothing later corrected it, so `PaymentDetails::amount_msat` understated multi-item payments. Record the total instead, in both the pending and failed records as well as the log line, and reject quantities whose total would overflow. Add an integration test paying for two items of an offer. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
jkczyz
force-pushed
the
2026-10-bolt12-quantity-amount
branch
from
October 22, 2026 22:29
088e70e to
f8f858c
Compare
Camillarhi
reviewed
Oct 23, 2026
Comment on lines
+325
to
+326
| Some(quantity) => { | ||
| offer_amount_msat.checked_mul(quantity).ok_or(Error::InvalidAmount)? |
Contributor
There was a problem hiding this comment.
nit: The other amount/offer checks in send() log before returning, but this one fails silently, and before this change, an overflow got logged via the LDK error path. Could we log here too?
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.
Fixes #1200.
When
Bolt12Payment::sendis given a quantity, the invoice request amount is the offer amount multiplied by that quantity, and that total is what the node pays. The payment record only stored the per-item offer amount, and thePaymentSenthandler never corrects it, soPaymentDetails::amount_msatunderstated multi-item payments.This records the total instead (pending and failed records, plus the log line), rejects quantities whose total would overflow with
Error::InvalidAmount, and adds an integration test paying for two items of an offer.🤖 Generated with Claude Code