Skip to content

feat: implement DLC splicing functionality#18

Merged
matthewjablack merged 3 commits into
developfrom
feat/dlc-splicing
Jul 9, 2025
Merged

feat: implement DLC splicing functionality#18
matthewjablack merged 3 commits into
developfrom
feat/dlc-splicing

Conversation

@matthewjablack

@matthewjablack matthewjablack commented Jul 8, 2025

Copy link
Copy Markdown

What

Implements DLC splicing functionality that enables using existing DLC funding outputs as inputs to new DLCs

Key Features

  • DlcInputInfo struct: Represents existing DLC funding outputs for reuse
  • Enhanced PartyParams: Added dlc_inputs_info field for DLC inputs
  • CreateSplicedDlcTransactions: Main function for creating DLCs with spliced inputs
  • Signature handling: Complete signing workflow for multisig DLC inputs
  • Fee management: Proper weight calculation for P2WSH multisig inputs (~220 bytes)

Splicing Scenarios Supported

  1. Splice-in: Add additional funds to create larger DLC
  2. Splice-out: Remove funds to create smaller DLC
  3. DLC transition: Change oracle, terms, or participants while reusing funds

Implementation Details

  • Converts DLC inputs to regular transaction inputs with proper serial ID ordering
  • Maintains compatibility with existing DLC transaction creation logic
  • Supports multiple DLC inputs per party
  • Handles signature ordering based on public key lexicographic order

Testing

  • 4 comprehensive test cases covering all splicing scenarios
  • Signature creation and verification tests
  • Edge case handling for fee calculations

- add DlcInputInfo struct for existing DLC funding outputs
- enhance PartyParams with dlc_inputs_info field
- implement CreateSplicedDlcTransactions for DLC-to-DLC transitions
- add DLC input signing functions with multisig support
- update fee calculation to account for DLC input weights
- add comprehensive tests for splice scenarios
Add validation for DLC splicing inputs including zero amount checks,
pubkey validation, and dust limit enforcement. Includes extensive
test coverage for all validation scenarios and edge cases.

- validate DLC input amounts and pubkey uniqueness
- enforce 546 sat dust limit on total input amounts
- add 8 new test cases covering validation scenarios
- improve error messages with party-specific context
@matthewjablack matthewjablack merged commit e1b4e21 into develop Jul 9, 2025
8 checks passed
@matthewjablack matthewjablack deleted the feat/dlc-splicing branch July 9, 2025 03:45
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.

1 participant