Skip to content

Hold fees - #843

Closed
joostjager wants to merge 1 commit into
lightning:masterfrom
joostjager:hold-fees
Closed

joostjager wants to merge 1 commit into
lightning:masterfrom
joostjager:hold-fees

Conversation

@joostjager

Copy link
Copy Markdown
Collaborator

This is a rough initial set of changes that outlines the idea put forward in the mailing list post Hold fee rates as DoS protection (channel spamming and jamming).

@t-bast t-bast mentioned this pull request Feb 15, 2021
10 of 23 tasks
@t-bast t-bast mentioned this pull request Feb 23, 2021
10 of 19 tasks
@t-bast t-bast mentioned this pull request Mar 15, 2021
2 of 9 tasks
@t-bast t-bast mentioned this pull request Mar 24, 2021
5 of 11 tasks
@t-bast t-bast mentioned this pull request Apr 8, 2021
3 of 9 tasks
@t-bast t-bast mentioned this pull request Apr 22, 2021
4 of 12 tasks
@t-bast t-bast mentioned this pull request May 10, 2021
2 of 9 tasks
@t-bast t-bast mentioned this pull request May 19, 2021
3 of 10 tasks
@t-bast t-bast mentioned this pull request Jun 17, 2021
3 of 12 tasks
@t-bast t-bast mentioned this pull request Jul 2, 2021
1 of 11 tasks
@t-bast t-bast mentioned this pull request Jul 16, 2021
5 of 15 tasks
@t-bast t-bast mentioned this pull request Aug 10, 2021
5 of 18 tasks
@t-bast t-bast mentioned this pull request Aug 27, 2021
3 of 15 tasks
@t-bast t-bast mentioned this pull request Sep 8, 2021
5 of 19 tasks
@t-bast t-bast mentioned this pull request Sep 23, 2021
6 of 19 tasks
@t-bast t-bast mentioned this pull request Oct 21, 2021
5 of 21 tasks
@t-bast t-bast mentioned this pull request Nov 5, 2021
5 of 21 tasks
@t-bast t-bast mentioned this pull request Nov 22, 2021
6 of 21 tasks
@t-bast t-bast mentioned this pull request Dec 6, 2021
8 of 21 tasks

@lightning-developer lightning-developer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall I am uncertain about the proposal itself and whether this is effective in mitigating the issue of spam (most arguments have been brought up in the replies on the mailing list)

Under the assumption we wish to move forward with this proposal or in this direction I think we should at least express the hold_duration and hold_fees in blocks instead of days

Comment thread 02-peer-protocol.md
* [`sha256`:`payment_hash`]
* [`u32`:`cltv_expiry`]
* [`1366*byte`:`onion_routing_packet`]
* [`u64`:`hold_fee_rate_day`]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not per block?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've chosen time because it matches the actual cost of locked funds closely. Blocks probably works just as well though.

Comment thread 02-peer-protocol.md
its commitment transaction, it cannot pay the fee for the updated local or
remote transaction at the current `feerate_per_kw` while maintaining its
channel reserve.
- SHOULD NOT offer a combination of `amount_msat`, `cltv_expiry`, `hold_fee_rate_day` and `hold_fee_discount` such that the remote node cannot pay the hold fee for the longest possible hold duration. The longest possible hold duration is the `cltv_expiry` delta in blocks multiplied by ten minutes. This must also take into account all currently outstanding htlcs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See the above comment. It seems strange to do this artificial conversion between wall clock time and block time when we already have cltv_expiry as the upper hold duration and a perfect time stamping server on the base layer.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, agreed that this causes friction for the calculation of the max hold fee.

Comment thread 02-peer-protocol.md
commitment transactions:
- MUST NOT send an `update_fulfill_htlc`, `update_fail_htlc`, or
`update_fail_malformed_htlc`.
- MUST set `hold_fee` to the hold fees that it owes the sending node. Let `hold_duration_days` be the actual time that the htlc was held, expressed in days. This value is calculated as `hold_fee_rate_day` (from `update_add_htlc`) * `hold_duration_days` - `hold_fee_discount` (also from `update_add_htlc`). Example: `hold_fee_rate_day`=200, `hold_fee_discount`=3, `hold_duration_days`=0.02 (30 minutes). Then `hold_fee` is 200 * 0.02 - 3 = 1 sat. `hold_fee` can be negative in which case the sending node owes the receiving node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in the case of minutes it is easy to compute the hold_duration_days but in reality there will be seconds and even milliseconds involved thus my repeated suggestion to stick with a hold_duration_blocks as the number of blocks since the htlc was offered and the current hight. It might still be tricky to negotiate the hold_duration_blocks if a new block is just being propagated. Nodes might either allow a grace period of a couple seconds or we need some mechanism to renegotiate this value.

@joostjager joostjager Dec 14, 2021 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, either way there must be a grace period. For regular lightning payments, there is a similar grace delta added by the sender to accommodate for blocks that are produced while the payment is in flight.

A per-block rate doesn't have the granularity of a per-time rate, but perhaps that isn't a problem. To combat spam, the minimum hold fee that the sender needs to pay to each node must be sufficiently high. Charging for a second of hold time is probably not enough, if it is even possible to express in msat.

Comment thread 04-onion-routing.md
2. data:
* [`32*byte`:`payment_secret`]
* [`tu64`:`total_msat`]
1. type: 10 (`hold_fee`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doesn't that conflict with onion messages in #759

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This PR is only conceptual at this stage.

Comment thread 04-onion-routing.md
- For every non-final node:
- MUST include `short_channel_id`
- MUST NOT include `payment_data`
- MUST set `hold_fee_rate_day` so that difference between incoming and outgoing `hold_fee_rate_day` for the receiving node is at least the expected value based on the receiving node's channel policy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not understand this sentence and thus not the requirement. Is that related to hold_fee_rate_ppm_day from BOLT 7 if so why not including hold_fee_rate_base_day? (while I probably just missed some point here I of course iterate that I would set those rates in blocks instead of days)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A node is paying a hold fee to the next node and receiving a hold fee from its predecessor. The idea of this sentence is to point out that a node must make sure that the difference between fees paid and fees received covers the hold fee that they require for themselves.

Similar to forwarding a lightning payment where nodes must make sure that the difference between incoming and outgoing amount is at least their desired routing fee.

@t-bast t-bast mentioned this pull request Jan 3, 2022
5 of 21 tasks
@t-bast t-bast mentioned this pull request Jan 12, 2022
6 of 18 tasks
@t-bast t-bast mentioned this pull request Jan 27, 2022
5 of 17 tasks
@t-bast t-bast mentioned this pull request Feb 9, 2022
3 of 17 tasks
@t-bast t-bast mentioned this pull request Feb 25, 2022
6 of 19 tasks
@Roasbeef Roasbeef mentioned this pull request Mar 14, 2022
16 of 23 tasks
@t-bast t-bast mentioned this pull request Mar 24, 2022
7 of 22 tasks
@t-bast t-bast mentioned this pull request Apr 7, 2022
6 of 20 tasks
@t-bast t-bast mentioned this pull request Apr 21, 2022
6 of 23 tasks
@t-bast t-bast mentioned this pull request May 4, 2022
4 of 22 tasks
@t-bast t-bast mentioned this pull request May 18, 2022
12 of 23 tasks
@t-bast t-bast mentioned this pull request Jun 16, 2022
5 of 24 tasks
@t-bast t-bast mentioned this pull request Jun 29, 2022
2 of 24 tasks
@Roasbeef Roasbeef mentioned this pull request Aug 1, 2022
13 of 25 tasks
@t-bast t-bast mentioned this pull request Aug 12, 2022
14 of 25 tasks
@t-bast t-bast mentioned this pull request Aug 29, 2022
5 of 25 tasks
@t-bast t-bast mentioned this pull request Sep 8, 2022
9 of 27 tasks
@t-bast t-bast mentioned this pull request Sep 22, 2022
15 of 27 tasks
@t-bast t-bast mentioned this pull request Oct 6, 2022
2 of 26 tasks
@t-bast t-bast mentioned this pull request Oct 19, 2022
5 of 26 tasks
@t-bast

t-bast commented Sep 18, 2024

Copy link
Copy Markdown
Collaborator

Superseded by #1071?

@t-bast t-bast closed this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants