@@ -57,8 +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,
61- TX_COMMON_FIELDS_WEIGHT,
60+ InteractiveTxMessageSendResult, InteractiveTxSigningSession, TX_COMMON_FIELDS_WEIGHT,
6261};
6362use crate::ln::msgs;
6463use crate::ln::msgs::{ClosingSigned, ClosingSignedFeeRange, DecodeError, OnionErrorPacket};
@@ -2628,24 +2627,12 @@ where
26282627 // Note: For the error case when the inputs are insufficient, it will be handled after
26292628 // the `calculate_change_output_value` call below
26302629 let mut funding_outputs = Vec::new();
2631- let mut expected_remote_shared_funding_output = None;
26322630
26332631 let shared_funding_output = TxOut {
26342632 value: Amount::from_sat(self.funding.get_value_satoshis()),
26352633 script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
26362634 };
26372635
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-
26492636 // Optionally add change output
26502637 let change_script = if let Some(script) = change_destination_opt {
26512638 script
@@ -2655,7 +2642,7 @@ where
26552642 };
26562643 let change_value_opt = calculate_change_output_value(
26572644 self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2658- &funding_inputs, &funding_outputs,
2645+ &shared_funding_output.script_pubkey, & funding_inputs, &funding_outputs,
26592646 self.dual_funding_context.funding_feerate_sat_per_1000_weight,
26602647 change_script.minimal_non_dust().to_sat(),
26612648 )?;
@@ -2670,7 +2657,7 @@ where
26702657 // Check dust limit again
26712658 if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
26722659 change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2673- funding_outputs.push(OutputOwned::Single( change_output) );
2660+ funding_outputs.push(change_output);
26742661 }
26752662 }
26762663
@@ -2683,8 +2670,8 @@ where
26832670 is_initiator: self.funding.is_outbound(),
26842671 funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
26852672 inputs_to_contribute: funding_inputs,
2673+ shared_funding_output: (shared_funding_output, self.dual_funding_context.our_funding_satoshis),
26862674 outputs_to_contribute: funding_outputs,
2687- expected_remote_shared_funding_output,
26882675 };
26892676 let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
26902677 let msg = tx_constructor.take_initiator_first_message();
@@ -11051,6 +11038,10 @@ where
1105111038 funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
1105211039 our_funding_inputs: our_funding_inputs.clone(),
1105311040 };
11041+ let shared_funding_output = TxOut {
11042+ value: Amount::from_sat(funding.get_value_satoshis()),
11043+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
11044+ };
1105411045
1105511046 let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
1105611047 InteractiveTxConstructorArgs {
@@ -11062,8 +11053,8 @@ where
1106211053 funding_tx_locktime: dual_funding_context.funding_tx_locktime,
1106311054 is_initiator: false,
1106411055 inputs_to_contribute: our_funding_inputs,
11056+ shared_funding_output: (shared_funding_output, our_funding_satoshis),
1106511057 outputs_to_contribute: Vec::new(),
11066- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
1106711058 }
1106811059 ).map_err(|_| ChannelError::Close((
1106911060 "V2 channel rejected due to sender error".into(),
0 commit comments