Skip to content

Commit

Permalink
Implement initial splice negotiation
Browse files Browse the repository at this point in the history
Handle the initial splice negotiation, without continuing
to transaction negotiation:
- `splice_channel()` for initiating splicing
- handling of `splice_init` and `splice_ack` messages, with checks
- `splice_ack` always fails (use case still imcomplete)
- A test to go through the use case (`test_v1_splice_in`)
  • Loading branch information
optout21 committed Mar 6, 2025
1 parent df68774 commit b0fd371
Show file tree
Hide file tree
Showing 8 changed files with 701 additions and 20 deletions.
21 changes: 21 additions & 0 deletions lightning/src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ pub const HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = 288;
/// outputs.
pub const HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = 327;

/// The size of the 2-of-2 multisig script
const MULTISIG_SCRIPT_SIZE: u64 =
1 + // OP_2
1 + // data len
33 + // pubkey1
1 + // data len
33 + // pubkey2
1 + // OP_2
1; // OP_CHECKMULTISIG
/// The weight of a funding transaction input (2-of-2 P2WSH)
/// See https://github.com/lightning/bolts/blob/master/03-transactions.md#expected-weight-of-the-commitment-transaction
pub const FUNDING_TRANSACTION_WITNESS_WEIGHT: u64 =
1 + // number_of_witness_elements
1 + // nil_len
1 + // sig len
73 + // sig1
1 + // sig len
73 + // sig2
1 + // witness_script_length
MULTISIG_SCRIPT_SIZE;

/// Gets the weight for an HTLC-Success transaction.
#[inline]
pub fn htlc_success_tx_weight(channel_type_features: &ChannelTypeFeatures) -> u64 {
Expand Down
Loading

0 comments on commit b0fd371

Please sign in to comment.