Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nodes to overshoot the MPP total_msat when paying #1031

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions 04-onion-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ The writer:
- otherwise:
- MUST set `total_msat` to the amount it wishes to pay.
- MUST ensure that the total `amount_msat` of the HTLC set which arrives at the payee
is equal to `total_msat`.
is equal to or greater than `total_msat`.
Copy link
Collaborator

@joostjager joostjager Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have #1032, shouldn't amount_msat be changed to the final amt_to_forward? To ensure that the sender remains in control of the set total?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, that's a good point!

Copy link
Collaborator

@joostjager joostjager Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it is still at the discretion of the receiver, but a premature release of the preimage may cause the receiver to receive less (although still meeting total_msat). With a premature release, routing nodes may short-cut pending htlcs.

So incentive-compatible is to only count the minimum towards total_msat, which is amt_to_forward?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that makes sense, don't hesitate to open a follow-up PR to fix that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same discussion as we had here? #1032 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but perhaps new is that we want to at least recommend the most incentive-compatible way in the spec?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I opened #1040 to fix that.

- MUST NOT send another HTLC if the total `amount_msat` of the HTLC set is already greater or equal to `total_msat`.
- MUST include `payment_secret`.
- otherwise:
Expand All @@ -307,7 +307,8 @@ The final node:
- MUST add it to the HTLC set corresponding to that `payment_hash`.
- SHOULD fail the entire HTLC set if `total_msat` is not the same for
all HTLCs in the set.
- if the total `amount_msat` of this HTLC set equals `total_msat`:
- if the total `amount_msat` of this HTLC set is equal to or greater than
`total_msat`:
- SHOULD fulfill all HTLCs in the HTLC set
- otherwise, if the total `amount_msat` of this HTLC set is less than
`total_msat`:
Expand All @@ -333,6 +334,13 @@ it simplifies adding noise to the amount when splitting, as well as
scenarios in which the senders are genuinely independent (friends
splitting a bill, for example).

Because a node may need to pay more than its desired amount (due to the
`htlc_minimum_msat` value of channels in the desired path), nodes are allowed
to pay more than the `total_msat` they specified. Otherwise, nodes would be
constrained in which paths they can take when retrying payments along specific
paths. However, no individual HTLC may be for less than the difference between
the total paid and `total_msat`.

The restriction on sending an HTLC once the set is over the agreed total prevents the preimage being released before all
the partial payments have arrived: that would allow any intermediate
node to immediately claim any outstanding partial payments.
Expand Down