Skip to content

Commit dc85194

Browse files
committed
Implement initial splice negotiation
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`)
1 parent df68774 commit dc85194

8 files changed

+701
-20
lines changed

lightning/src/ln/chan_utils.rs

+21
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,27 @@ pub const HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = 288;
8181
/// outputs.
8282
pub const HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = 327;
8383

84+
/// The size of the 2-of-2 multisig script
85+
const MULTISIG_SCRIPT_SIZE: u64 =
86+
1 + // OP_2
87+
1 + // data len
88+
33 + // pubkey1
89+
1 + // data len
90+
33 + // pubkey2
91+
1 + // OP_2
92+
1; // OP_CHECKMULTISIG
93+
/// The weight of a funding transaction input (2-of-2 P2WSH)
94+
/// See https://github.com/lightning/bolts/blob/master/03-transactions.md#expected-weight-of-the-commitment-transaction
95+
pub const FUNDING_TRANSACTION_WITNESS_WEIGHT: u64 =
96+
1 + // number_of_witness_elements
97+
1 + // nil_len
98+
1 + // sig len
99+
73 + // sig1
100+
1 + // sig len
101+
73 + // sig2
102+
1 + // witness_script_length
103+
MULTISIG_SCRIPT_SIZE;
104+
84105
/// Gets the weight for an HTLC-Success transaction.
85106
#[inline]
86107
pub fn htlc_success_tx_weight(channel_type_features: &ChannelTypeFeatures) -> u64 {

0 commit comments

Comments
 (0)