@@ -57,7 +57,7 @@ use crate::ln::channelmanager::{
5757use crate::ln::interactivetxs::{
5858 calculate_change_output_value, get_output_weight, AbortReason, HandleTxCompleteResult,
5959 InteractiveTxConstructor, InteractiveTxConstructorArgs, InteractiveTxMessageSend,
60- InteractiveTxMessageSendResult, InteractiveTxSigningSession, OutputOwned, SharedOwnedOutput,
60+ InteractiveTxMessageSendResult, InteractiveTxSigningSession,
6161 TX_COMMON_FIELDS_WEIGHT,
6262};
6363use crate::ln::msgs;
@@ -2628,24 +2628,12 @@ where
26282628 // Note: For the error case when the inputs are insufficient, it will be handled after
26292629 // the `calculate_change_output_value` call below
26302630 let mut funding_outputs = Vec::new();
2631- let mut expected_remote_shared_funding_output = None;
26322631
26332632 let shared_funding_output = TxOut {
26342633 value: Amount::from_sat(self.funding.get_value_satoshis()),
26352634 script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
26362635 };
26372636
2638- if self.funding.is_outbound() {
2639- funding_outputs.push(
2640- OutputOwned::Shared(SharedOwnedOutput::new(
2641- shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2642- ))
2643- );
2644- } else {
2645- let TxOut { value, script_pubkey } = shared_funding_output;
2646- expected_remote_shared_funding_output = Some((script_pubkey, value.to_sat()));
2647- }
2648-
26492637 // Optionally add change output
26502638 let change_script = if let Some(script) = change_destination_opt {
26512639 script
@@ -2655,7 +2643,7 @@ where
26552643 };
26562644 let change_value_opt = calculate_change_output_value(
26572645 self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2658- &funding_inputs, &funding_outputs,
2646+ &shared_funding_output.script_pubkey, & funding_inputs, &funding_outputs,
26592647 self.dual_funding_context.funding_feerate_sat_per_1000_weight,
26602648 change_script.minimal_non_dust().to_sat(),
26612649 )?;
@@ -2670,7 +2658,7 @@ where
26702658 // Check dust limit again
26712659 if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
26722660 change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2673- funding_outputs.push(OutputOwned::Single( change_output) );
2661+ funding_outputs.push(change_output);
26742662 }
26752663 }
26762664
@@ -2683,8 +2671,8 @@ where
26832671 is_initiator: self.funding.is_outbound(),
26842672 funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
26852673 inputs_to_contribute: funding_inputs,
2674+ shared_funding_output: (shared_funding_output, self.dual_funding_context.our_funding_satoshis),
26862675 outputs_to_contribute: funding_outputs,
2687- expected_remote_shared_funding_output,
26882676 };
26892677 let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
26902678 let msg = tx_constructor.take_initiator_first_message();
@@ -11051,6 +11039,10 @@ where
1105111039 funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
1105211040 our_funding_inputs: our_funding_inputs.clone(),
1105311041 };
11042+ let shared_funding_output = TxOut {
11043+ value: Amount::from_sat(funding.get_value_satoshis()),
11044+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
11045+ };
1105411046
1105511047 let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
1105611048 InteractiveTxConstructorArgs {
@@ -11062,8 +11054,8 @@ where
1106211054 funding_tx_locktime: dual_funding_context.funding_tx_locktime,
1106311055 is_initiator: false,
1106411056 inputs_to_contribute: our_funding_inputs,
11057+ shared_funding_output: (shared_funding_output, our_funding_satoshis),
1106511058 outputs_to_contribute: Vec::new(),
11066- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
1106711059 }
1106811060 ).map_err(|_| ChannelError::Close((
1106911061 "V2 channel rejected due to sender error".into(),
0 commit comments