Introduce new commitment format to enforce channel lease expirations in scripts#5709
Merged
Roasbeef merged 18 commits intolightningnetwork:masterfrom Oct 21, 2021
Merged
Conversation
|
Visit https://dashboard.github.orijtech.com?back=0&pr=5709&remote=true&repo=Roasbeef%2Flnd to see benchmark details. |
a901a57 to
70e2d5a
Compare
Member
Author
|
Rebased again, itests got borked during the original rebase, looking into the failure, prob a stray guard based on the new commitment types somewhere. |
The new commitment type consists of adding an additional CLTV requirement to guarantee a leased channel's expiration on any commitment and HTLC outputs that pay directly to the channel initiator.
This witness generators and weight estimates added only apply for the new script-enforced leased channel commitment type.
This commit modifies the channel state machine to be able to derive the proper commitment and second-level HTLC output scripts required by the new script-enforced leased channel commitment type.
In order to sweep the commitment and HTLC outputs belonging to a script-enforced leased channel, each resolver must know whether the additional CLTV clause on the channel initiator applies to them. To do so, we retrieve the historical channel state stored within the database and supplement it to the resolvers to provide them with what's needed in order to sweep the necessary outputs and resolve their respective contracts.
This aims to cover an edge case and also serves as an optimization of what happens when an input that was offered to the Sweeper with an exclusive group is re-offered without one. This happens every time we attempt to sweep the different possible anchors of a channel at the time of broadcast, as we don't know which commitment transaction will end up confirming in the chain. Once the commitment transaction confirms however, we know which anchor output to act upon and re-offer it to the Sweeper without an exclusive group. At this point, the Sweeper will continue to attempt sweeping the other anchor output versions even know we know they are not valid.
We update several of our integration tests that exercise different scenarios with regards to the broadcast of a channel commitment transaction with HTLCs in-flight to use the new commitment type for channel leases. We do this to ensure we have complete coverage of said channel commitment type. This required changing several assumptions throughout the tests based on when we should expect sweeps to happen.
70e2d5a to
08d93fd
Compare
Member
Author
|
Rebased once again! Found an issue in the OG rebase thanks to @guggero |
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.
Replaces #5549
See PR body there