feat: spliced dlc#4
Open
bennyhodl wants to merge 2 commits into
Open
Conversation
e389637 to
d215bc7
Compare
04a93fb to
d7c796b
Compare
1d4e474 to
e0399a8
Compare
e0399a8 to
3342ae0
Compare
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.
Add DLC Splicing Support
This pull request implements DLC splicing functionality, allowing existing confirmed DLC contracts to be used as inputs for new DLC contracts. This enables users to efficiently chain DLCs together without needing to close and settle previous contracts on-chain.
How it works
The implementation extends the existing DLC messaging protocol by adding an optional
DlcInputsubtype toFundingInputmessages. When present, this subtype contains the funding public keys from both parties and the contract ID of an existing confirmed DLC that will be consumed as input.The splicing flow follows the standard DLC negotiation process (offer → accept → sign) with enhanced funding input handling:
Offer Phase: When creating a splice offer, the system identifies confirmed DLC contracts that can serve as inputs and includes their details in the
DlcInputoptional fields of the funding inputs.Accept Phase: The accepting party processes splice offers the same way as regular offers, but the system recognizes DLC inputs and handles them appropriately during transaction construction.
Signing Phase: During contract verification and signing, the system automatically:
The funding transaction construction seamlessly integrates DLC inputs alongside regular UTXOs, with proper weight and fee calculations. The spending conditions for DLC inputs are satisfied through the standard 2-of-2 multisig script, where both parties contribute their signatures to unlock the funds from the previous contract.
This implementation maintains backward compatibility with existing DLC contracts while enabling efficient contract chaining. The PR includes comprehensive test cases covering both "splice-in" scenarios (adding collateral from external sources plus existing DLCs) and "splice-out" scenarios (reducing total collateral by consuming DLC inputs).