-
Notifications
You must be signed in to change notification settings - Fork 47
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
bLIP-0025: Allow forwarding HTLCs that underpay the onion encoded value #25
Merged
TheBlueMatt
merged 1 commit into
lightning:master
from
valentinewallace:2023-05-forward-less-than-onion
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
``` | ||
bLIP: 25 | ||
Title: Allow forwarding HTLCs with less value than the onion claims to pay | ||
Status: Draft | ||
Author: Valentine Wallace <[email protected]> | ||
Created: 2023-05-22 | ||
License: CC0 | ||
``` | ||
|
||
## Abstract | ||
|
||
Penultimate hops in lightning payment paths may want to take an extra fee from the payee's final | ||
received value. To do so, they can simply forward less than the amount encoded in the onion by the | ||
sender, and specify the exact fee they took in a new `update_add_htlc` TLV for the receiver to | ||
verify. | ||
|
||
## Copyright | ||
|
||
This bLIP is licensed under the CC0 license. | ||
|
||
## Specification | ||
|
||
We define a TLV field for `update_add_htlc` that allows a relaying node to | ||
relay a smaller amount than the amount encoded in the onion: | ||
|
||
1. `tlv_stream`: `update_add_htlc_tlvs` | ||
2. types: | ||
1. type: 65537 (`extra_fee`) | ||
2. data: | ||
- [`u64`:`amount_msat`] | ||
|
||
The writer: | ||
* MUST set `extra_fee` to the amount of extra fee they took from the receiver's final value | ||
|
||
The receiver: | ||
* MUST fail the HTLC if they did not expect an extra fee to be taken or if the extra fee taken is | ||
too high | ||
* MUST either accept or reject the HTLC as if it had received `htlc_value + extra_fee` | ||
|
||
## Motivation | ||
|
||
For context, it is expected that many lightning users will be connected to the lightning network via | ||
Lightning Service Providers (LSPs), who are responsible for managing channel liquidity on end users' | ||
behalf. | ||
|
||
Often, users are onboarded to these services via a just-in-time inbound channel when they first | ||
receive a payment. However, this channel open costs money, and so liquidity providers may want to | ||
take an extra fee so that users can help bear the cost of this initial on-chain fee. | ||
|
||
## Rationale | ||
|
||
While it would be possible to avoid the extra TLV record if receivers could be trusted to calculate | ||
that the fee taken by the penultimate hop is as-expected, in practice this may be tricky to get | ||
right. If there were a bug in this logic, a sender could exploit it by forwarding less than the | ||
invoice's expected value, and receive proof-of-payment that they paid the full value. | ||
|
||
## Implementation Notes | ||
See | ||
<https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#3--invoice-generation> | ||
for invoice requirements if this feature is being used in the JIT channel context. | ||
|
||
## Reference Implementations | ||
LDK: <https://github.com/lightningdevkit/rust-lightning/pull/2319> |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipped this to keep consistency with the rest of the file.