Skip to content

Commit e9ce486

Browse files
authored
Merge pull request #4261 from jkczyz/2025-12-splice-in-and-out
Mixed mode splicing
2 parents b9c1a72 + 8eb9e70 commit e9ce486

File tree

6 files changed

+490
-257
lines changed

6 files changed

+490
-257
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,11 +1897,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
18971897

18981898
0xa0 => {
18991899
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 0).unwrap();
1900-
let contribution = SpliceContribution::SpliceIn {
1901-
value: Amount::from_sat(10_000),
1902-
inputs: vec![input],
1903-
change_script: None,
1904-
};
1900+
let contribution =
1901+
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
19051902
let funding_feerate_sat_per_kw = fee_est_a.ret_val.load(atomic::Ordering::Acquire);
19061903
if let Err(e) = nodes[0].splice_channel(
19071904
&chan_a_id,
@@ -1919,11 +1916,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
19191916
},
19201917
0xa1 => {
19211918
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 1).unwrap();
1922-
let contribution = SpliceContribution::SpliceIn {
1923-
value: Amount::from_sat(10_000),
1924-
inputs: vec![input],
1925-
change_script: None,
1926-
};
1919+
let contribution =
1920+
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
19271921
let funding_feerate_sat_per_kw = fee_est_b.ret_val.load(atomic::Ordering::Acquire);
19281922
if let Err(e) = nodes[1].splice_channel(
19291923
&chan_a_id,
@@ -1941,11 +1935,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
19411935
},
19421936
0xa2 => {
19431937
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 0).unwrap();
1944-
let contribution = SpliceContribution::SpliceIn {
1945-
value: Amount::from_sat(10_000),
1946-
inputs: vec![input],
1947-
change_script: None,
1948-
};
1938+
let contribution =
1939+
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
19491940
let funding_feerate_sat_per_kw = fee_est_b.ret_val.load(atomic::Ordering::Acquire);
19501941
if let Err(e) = nodes[1].splice_channel(
19511942
&chan_b_id,
@@ -1963,11 +1954,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
19631954
},
19641955
0xa3 => {
19651956
let input = FundingTxInput::new_p2wpkh(coinbase_tx.clone(), 1).unwrap();
1966-
let contribution = SpliceContribution::SpliceIn {
1967-
value: Amount::from_sat(10_000),
1968-
inputs: vec![input],
1969-
change_script: None,
1970-
};
1957+
let contribution =
1958+
SpliceContribution::splice_in(Amount::from_sat(10_000), vec![input], None);
19711959
let funding_feerate_sat_per_kw = fee_est_c.ret_val.load(atomic::Ordering::Acquire);
19721960
if let Err(e) = nodes[2].splice_channel(
19731961
&chan_b_id,
@@ -1995,12 +1983,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
19951983
.map(|chan| chan.outbound_capacity_msat)
19961984
.unwrap();
19971985
if outbound_capacity_msat >= 20_000_000 {
1998-
let contribution = SpliceContribution::SpliceOut {
1999-
outputs: vec![TxOut {
2000-
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2001-
script_pubkey: coinbase_tx.output[0].script_pubkey.clone(),
2002-
}],
2003-
};
1986+
let contribution = SpliceContribution::splice_out(vec![TxOut {
1987+
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
1988+
script_pubkey: coinbase_tx.output[0].script_pubkey.clone(),
1989+
}]);
20041990
let funding_feerate_sat_per_kw =
20051991
fee_est_a.ret_val.load(atomic::Ordering::Acquire);
20061992
if let Err(e) = nodes[0].splice_channel(
@@ -2026,12 +2012,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
20262012
.map(|chan| chan.outbound_capacity_msat)
20272013
.unwrap();
20282014
if outbound_capacity_msat >= 20_000_000 {
2029-
let contribution = SpliceContribution::SpliceOut {
2030-
outputs: vec![TxOut {
2031-
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2032-
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
2033-
}],
2034-
};
2015+
let contribution = SpliceContribution::splice_out(vec![TxOut {
2016+
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2017+
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
2018+
}]);
20352019
let funding_feerate_sat_per_kw =
20362020
fee_est_b.ret_val.load(atomic::Ordering::Acquire);
20372021
if let Err(e) = nodes[1].splice_channel(
@@ -2057,12 +2041,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
20572041
.map(|chan| chan.outbound_capacity_msat)
20582042
.unwrap();
20592043
if outbound_capacity_msat >= 20_000_000 {
2060-
let contribution = SpliceContribution::SpliceOut {
2061-
outputs: vec![TxOut {
2062-
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2063-
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
2064-
}],
2065-
};
2044+
let contribution = SpliceContribution::splice_out(vec![TxOut {
2045+
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2046+
script_pubkey: coinbase_tx.output[1].script_pubkey.clone(),
2047+
}]);
20662048
let funding_feerate_sat_per_kw =
20672049
fee_est_b.ret_val.load(atomic::Ordering::Acquire);
20682050
if let Err(e) = nodes[1].splice_channel(
@@ -2088,12 +2070,10 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
20882070
.map(|chan| chan.outbound_capacity_msat)
20892071
.unwrap();
20902072
if outbound_capacity_msat >= 20_000_000 {
2091-
let contribution = SpliceContribution::SpliceOut {
2092-
outputs: vec![TxOut {
2093-
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2094-
script_pubkey: coinbase_tx.output[2].script_pubkey.clone(),
2095-
}],
2096-
};
2073+
let contribution = SpliceContribution::splice_out(vec![TxOut {
2074+
value: Amount::from_sat(MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS),
2075+
script_pubkey: coinbase_tx.output[2].script_pubkey.clone(),
2076+
}]);
20972077
let funding_feerate_sat_per_kw =
20982078
fee_est_c.ret_val.load(atomic::Ordering::Acquire);
20992079
if let Err(e) = nodes[2].splice_channel(

lightning-tests/src/upgrade_downgrade_tests.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,10 @@ fn do_test_0_1_htlc_forward_after_splice(fail_htlc: bool) {
451451
reconnect_b_c_args.send_announcement_sigs = (true, true);
452452
reconnect_nodes(reconnect_b_c_args);
453453

454-
let contribution = SpliceContribution::SpliceOut {
455-
outputs: vec![TxOut {
456-
value: Amount::from_sat(1_000),
457-
script_pubkey: nodes[0].wallet_source.get_change_script().unwrap(),
458-
}],
459-
};
454+
let contribution = SpliceContribution::splice_out(vec![TxOut {
455+
value: Amount::from_sat(1_000),
456+
script_pubkey: nodes[0].wallet_source.get_change_script().unwrap(),
457+
}]);
460458
let splice_tx = splice_channel(&nodes[0], &nodes[1], ChannelId(chan_id_bytes_a), contribution);
461459
for node in nodes.iter() {
462460
mine_transaction(node, &splice_tx);

0 commit comments

Comments
 (0)