lnpeer/lnutil: fail mpp if we didn't signal mpp in invoice#10351
Merged
SomberNight merged 6 commits intospesmilo:masterfrom Dec 10, 2025
Merged
lnpeer/lnutil: fail mpp if we didn't signal mpp in invoice#10351SomberNight merged 6 commits intospesmilo:masterfrom
SomberNight merged 6 commits intospesmilo:masterfrom
Conversation
SomberNight
reviewed
Dec 8, 2025
Comment on lines
+3080
to
+3082
| if jit_opening_fees_msat and len(mpp_set.htlcs) > 1: | ||
| # we don't support mpp with just-in-time channel openings, the payer has to send a single htlc | ||
| return OnionFailureCode.INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS, None, None |
Member
There was a problem hiding this comment.
Ideally we should know whether the invoice we created signalled MPP, and just check against that.
That would work if e.g. invoice_features were part of payment_info. In that case the check could even be done on the individual htlc in _check_unfulfilled_htlc.
but ok, not sure if we want to do that now
Member
Author
There was a problem hiding this comment.
Doing that now in 0ce2fa8.
It seems cleaner and more generic.
The persisted features could get stale if the user changes the config (e.g. from gossip to trampoline), then shows the invoice again and tries to pay it, though i guess thats acceptable
SomberNight
reviewed
Dec 8, 2025
Prevents accidentally passing None if channel.short_id is not set yet
Store the channel id instead of the scid in ReceivedMPPHtlc. The scid can be None, in theory even for multiple channels at the same time. Using the channel_id which is always available and unique seems less error prone at the cost of temporarily higher storage requirements in the db for the duration of the pending htlcs. Alternatively we could use the local scid alias however using the channel_id seems less complex and leaves less room for ambiguity.
c50589f to
5421fa6
Compare
Adds the invoice features to the `PaymentInfo` class so we can check if the sender respects our requested features (e.g. if they tried to send mpp if we requested no mpp).
Fail incoming htlcs if we receive a payment consisting of multiple parts if we signaled to not want mpp in the invoice.
5421fa6 to
7c01d9d
Compare
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.
Followup of #10348
Fails incoming htlcs if we requested a single part payment by disabling the mpp flag in the invoice features but the sender sent us multiple htlcs anyways. This is done by storing the invoice features in the PaymentInfo class and checking against them when receiving the htlcs.
Also changes the channel reference in
ReceivedMPPHtlcfromscidto the fullchannel_idto simplify it and prevent issues with just in time channels where the scid can be None as the channel is used before a funding tx has been mined. (Alternatively we could use the local scid alias, but that seems more error prone).