@@ -58,7 +58,7 @@ use crate::ln::channelmanager::{
5858use crate::ln::interactivetxs::{
5959 calculate_change_output_value, get_output_weight, AbortReason, HandleTxCompleteResult,
6060 InteractiveTxConstructor, InteractiveTxConstructorArgs, InteractiveTxMessageSend,
61- InteractiveTxMessageSendResult, InteractiveTxSigningSession, OutputOwned, SharedOwnedOutput,
61+ InteractiveTxMessageSendResult, InteractiveTxSigningSession, SharedOwnedOutput,
6262 TX_COMMON_FIELDS_WEIGHT,
6363};
6464use crate::ln::msgs;
@@ -2785,24 +2785,12 @@ where
27852785 // Note: For the error case when the inputs are insufficient, it will be handled after
27862786 // the `calculate_change_output_value` call below
27872787 let mut funding_outputs = Vec::new();
2788- let mut expected_remote_shared_funding_output = None;
27892788
27902789 let shared_funding_output = TxOut {
27912790 value: Amount::from_sat(self.funding.get_value_satoshis()),
27922791 script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
27932792 };
27942793
2795- if self.funding.is_outbound() {
2796- funding_outputs.push(
2797- OutputOwned::Shared(SharedOwnedOutput::new(
2798- shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2799- ))
2800- );
2801- } else {
2802- let TxOut { value, script_pubkey } = shared_funding_output;
2803- expected_remote_shared_funding_output = Some((script_pubkey, value.to_sat()));
2804- }
2805-
28062794 // Optionally add change output
28072795 let change_script = if let Some(script) = change_destination_opt {
28082796 script
@@ -2812,7 +2800,8 @@ where
28122800 };
28132801 let change_value_opt = calculate_change_output_value(
28142802 self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2815- &funding_inputs, &funding_outputs,
2803+ &funding_inputs, None,
2804+ &shared_funding_output.script_pubkey, &funding_outputs,
28162805 self.dual_funding_context.funding_feerate_sat_per_1000_weight,
28172806 change_script.minimal_non_dust().to_sat(),
28182807 )?;
@@ -2827,7 +2816,7 @@ where
28272816 // Check dust limit again
28282817 if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
28292818 change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2830- funding_outputs.push(OutputOwned::Single( change_output) );
2819+ funding_outputs.push(change_output);
28312820 }
28322821 }
28332822
@@ -2840,8 +2829,9 @@ where
28402829 is_initiator: self.funding.is_outbound(),
28412830 funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
28422831 inputs_to_contribute: funding_inputs,
2832+ shared_funding_input: None,
2833+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.dual_funding_context.our_funding_satoshis),
28432834 outputs_to_contribute: funding_outputs,
2844- expected_remote_shared_funding_output,
28452835 };
28462836 let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
28472837 let msg = tx_constructor.take_initiator_first_message();
@@ -12036,6 +12026,10 @@ where
1203612026 funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
1203712027 our_funding_inputs: our_funding_inputs.clone(),
1203812028 };
12029+ let shared_funding_output = TxOut {
12030+ value: Amount::from_sat(funding.get_value_satoshis()),
12031+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
12032+ };
1203912033
1204012034 let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
1204112035 InteractiveTxConstructorArgs {
@@ -12047,8 +12041,9 @@ where
1204712041 funding_tx_locktime: dual_funding_context.funding_tx_locktime,
1204812042 is_initiator: false,
1204912043 inputs_to_contribute: our_funding_inputs,
12044+ shared_funding_input: None,
12045+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, our_funding_satoshis),
1205012046 outputs_to_contribute: Vec::new(),
12051- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
1205212047 }
1205312048 ).map_err(|err| {
1205412049 let reason = ClosureReason::ProcessingError { err: err.to_string() };
0 commit comments