-
Notifications
You must be signed in to change notification settings - Fork 493
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
feature: define option_zero_htlc_tx_fee (feature 22/23) #824
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -378,10 +378,14 @@ This message introduces the `channel_id` to identify the channel. It's derived f | |
#### Requirements | ||
|
||
Both peers: | ||
- if `option_static_remotekey` or `option_anchor_outputs` was negotiated: | ||
- `option_static_remotekey` or `option_anchor_outputs` applies to all commitment transactions | ||
- if `option_static_remotekey`, `option_anchor_outputs` or | ||
`option_anchors_zero_fee_htlc_tx` was negotiated: | ||
- `option_static_remotekey`, `option_anchor_outputs` or | ||
`option_anchors_zero_fee_htlc_tx` applies to all commitment transactions | ||
- otherwise: | ||
- `option_static_remotekey` or `option_anchor_outputs` does not apply to any commitment transactions | ||
- `option_static_remotekey`, `option_anchor_outputs` or | ||
`option_anchors_zero_fee_htlc_tx` does not apply to any commitment | ||
transactions | ||
|
||
The sender MUST set: | ||
- `channel_id` by exclusive-OR of the `funding_txid` and the `funding_output_index` from the `funding_created` message. | ||
|
@@ -396,10 +400,19 @@ The recipient: | |
|
||
#### Rationale | ||
|
||
We decide on `option_static_remotekey` or `option_anchor_outputs` at this point when we first have to generate the commitment | ||
transaction. The feature bits that were communicated in the `init` message exchange for the current connection determine | ||
the channel commitment format for the total lifetime of the channel. Even if a later reconnection does not negotiate this parameter, | ||
this channel will continue to use `option_static_remotekey` or `option_anchor_outputs`; we don't support "downgrading". | ||
We decide on `option_static_remotekey`, `option_anchor_outputs` or | ||
`option_anchors_zero_fee_htlc_tx` at this point when we first have to generate | ||
the commitment transaction. The feature bits that were communicated in the | ||
`init` message exchange for the current connection determine the channel | ||
commitment format for the total lifetime of the channel. Even if a later | ||
reconnection does not negotiate this parameter, this channel will continue to | ||
use `option_static_remotekey`, `option_anchor_outputs` or | ||
`option_anchors_zero_fee_htlc_tx`; we don't support "downgrading". | ||
|
||
`option_anchors_zero_fee_htlc_tx` is considered superior to | ||
`option_anchor_outputs`, which again is considered superior to | ||
`option_static_remotekey`, and the superior one is is favored if more than one | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: s/is//g |
||
is negotiated. | ||
|
||
### The `funding_locked` Message | ||
|
||
|
@@ -814,7 +827,7 @@ A sending node: | |
transaction, it cannot pay the fee for either the local or remote commitment | ||
transaction at the current `feerate_per_kw` while maintaining its channel | ||
reserve (see [Updating Fees](#updating-fees-update_fee)). | ||
- if `option_anchor_outputs` applies to this commitment transaction and the sending | ||
- if `option_anchors` applies to this commitment transaction and the sending | ||
node is the funder: | ||
- MUST be able to additionally pay for `to_local_anchor` and | ||
`to_remote_anchor` above its reserve. | ||
|
@@ -1039,9 +1052,13 @@ offline until after sending `commitment_signed`. Once | |
those HTLCs, and cannot fail the related incoming HTLCs until the | ||
output HTLCs are fully resolved. | ||
|
||
Note that the `htlc_signature` implicitly enforces the time-lock mechanism in the case of offered HTLCs being timed out or received HTLCs being spent. This is done to reduce fees by creating smaller scripts compared to explicitly stating time-locks on HTLC outputs. | ||
Note that the `htlc_signature` implicitly enforces the time-lock mechanism in | ||
the case of offered HTLCs being timed out or received HTLCs being spent. This | ||
is done to reduce fees by creating smaller scripts compared to explicitly | ||
stating time-locks on HTLC outputs. | ||
|
||
The `option_anchor_outputs` allows HTLC transactions to "bring their own fees" by attaching other inputs and outputs, hence the modified signature flags. | ||
The `option_anchors` allows HTLC transactions to "bring their own fees" by | ||
attaching other inputs and outputs, hence the modified signature flags. | ||
|
||
### Completing the Transition to the Updated State: `revoke_and_ack` | ||
|
||
|
@@ -1128,10 +1145,10 @@ A receiving node: | |
#### Rationale | ||
|
||
Bitcoin fees are required for unilateral closes to be effective. | ||
With `option_anchor_outputs`, `feerate_per_kw` is not as critical anymore to | ||
guarantee confirmation as it was in the legacy commitment format, but it still | ||
needs to be enough to be able to enter the mempool (satisfy min relay fee and | ||
mempool min fee). | ||
With `option_anchors`, `feerate_per_kw` is not as critical anymore to guarantee | ||
confirmation as it was in the legacy commitment format, but it still needs to | ||
be enough to be able to enter the mempool (satisfy min relay fee and mempool | ||
min fee). | ||
|
||
For the legacy commitment format, there is no general method for the | ||
broadcasting node to use child-pays-for-parent to increase its effective fee. | ||
|
@@ -1222,7 +1239,8 @@ The sending node: | |
next `commitment_signed` it expects to receive. | ||
- MUST set `next_revocation_number` to the commitment number of the | ||
next `revoke_and_ack` message it expects to receive. | ||
- if `option_static_remotekey` applies to the commitment transaction: | ||
- if `option_static_remotekey` or `option_anchors` applies to the commitment | ||
transaction: | ||
- MUST set `my_current_per_commitment_point` to a valid point. | ||
- otherwise: | ||
- MUST set `my_current_per_commitment_point` to its commitment point for | ||
|
@@ -1269,7 +1287,8 @@ A node: | |
- SHOULD fail the channel. | ||
|
||
A receiving node: | ||
- if `option_static_remotekey` applies to the commitment transaction: | ||
- if `option_static_remotekey` or `option_anchors` applies to the commitment | ||
transaction: | ||
- if `next_revocation_number` is greater than expected above, AND | ||
`your_last_per_commitment_secret` is correct for that | ||
`next_revocation_number` minus 1: | ||
|
Oops, something went wrong.
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.
since
option_anchors
has been added to cover_outputs
and_zero_fee_htlc_tx
, why is it not used here?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.
Worse, you don't define what the effect is if both are negotiated!
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.
If both are negotiated, then both can apply which I don't think is a problem since the latter is a superset of features.
I added a rationale and also specified
option_anchors
the places whereoption_static_remotekey
defines behavior (since technicallyoption_anchors_zero_fee_htlc_tx
does no longer depend onoption_static_remotekey
): 75a4cde