Skip to content

Commit 9151a72

Browse files
committed
Add Shared Input support
1 parent 4f341ef commit 9151a72

File tree

4 files changed

+530
-135
lines changed

4 files changed

+530
-135
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,8 @@ where
26432643
};
26442644
let change_value_opt = calculate_change_output_value(
26452645
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2646-
&shared_funding_output.script_pubkey, &funding_inputs, &funding_outputs,
2646+
&funding_inputs, None,
2647+
&shared_funding_output.script_pubkey, &funding_outputs,
26472648
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
26482649
change_script.minimal_non_dust().to_sat(),
26492650
)?;
@@ -2671,6 +2672,7 @@ where
26712672
is_initiator: self.funding.is_outbound(),
26722673
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
26732674
inputs_to_contribute: funding_inputs,
2675+
shared_funding_input: None,
26742676
shared_funding_output: (shared_funding_output, self.dual_funding_context.our_funding_satoshis),
26752677
outputs_to_contribute: funding_outputs,
26762678
};
@@ -11054,6 +11056,7 @@ where
1105411056
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
1105511057
is_initiator: false,
1105611058
inputs_to_contribute: our_funding_inputs,
11059+
shared_funding_input: None,
1105711060
shared_funding_output: (shared_funding_output, our_funding_satoshis),
1105811061
outputs_to_contribute: Vec::new(),
1105911062
}

lightning/src/ln/dual_funding_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ fn do_test_v2_channel_establishment(session: V2ChannelEstablishmentTestSession)
8989
let tx_add_input_msg = TxAddInput {
9090
channel_id,
9191
serial_id: 2, // Even serial_id from initiator.
92-
prevtx: initiator_funding_inputs[0].1.clone(),
92+
prevtx: Some(initiator_funding_inputs[0].1.clone()),
9393
prevtx_out: 0,
9494
sequence: initiator_funding_inputs[0].0.sequence.0,
9595
shared_input_txid: None,
9696
};
9797
let input_value =
98-
tx_add_input_msg.prevtx.as_transaction().output[tx_add_input_msg.prevtx_out as usize].value;
98+
tx_add_input_msg.prevtx.as_ref().unwrap().as_transaction().output[tx_add_input_msg.prevtx_out as usize].value;
9999
assert_eq!(input_value.to_sat(), session.initiator_input_value_satoshis);
100100

101101
nodes[1].node.handle_tx_add_input(nodes[0].node.get_our_node_id(), &tx_add_input_msg);

0 commit comments

Comments
 (0)