@@ -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};
@@ -2784,24 +2783,12 @@ where
27842783 // Note: For the error case when the inputs are insufficient, it will be handled after
27852784 // the `calculate_change_output_value` call below
27862785 let mut funding_outputs = Vec::new();
2787- let mut expected_remote_shared_funding_output = None;
27882786
27892787 let shared_funding_output = TxOut {
27902788 value: Amount::from_sat(self.funding.get_value_satoshis()),
27912789 script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
27922790 };
27932791
2794- if self.funding.is_outbound() {
2795- funding_outputs.push(
2796- OutputOwned::Shared(SharedOwnedOutput::new(
2797- shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2798- ))
2799- );
2800- } else {
2801- let TxOut { value, script_pubkey } = shared_funding_output;
2802- expected_remote_shared_funding_output = Some((script_pubkey, value.to_sat()));
2803- }
2804-
28052792 // Optionally add change output
28062793 let change_script = if let Some(script) = change_destination_opt {
28072794 script
@@ -2811,7 +2798,7 @@ where
28112798 };
28122799 let change_value_opt = calculate_change_output_value(
28132800 self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2814- &funding_inputs, &funding_outputs,
2801+ &shared_funding_output.script_pubkey, & funding_inputs, &funding_outputs,
28152802 self.dual_funding_context.funding_feerate_sat_per_1000_weight,
28162803 change_script.minimal_non_dust().to_sat(),
28172804 )?;
@@ -2826,7 +2813,7 @@ where
28262813 // Check dust limit again
28272814 if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
28282815 change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2829- funding_outputs.push(OutputOwned::Single( change_output) );
2816+ funding_outputs.push(change_output);
28302817 }
28312818 }
28322819
@@ -2839,8 +2826,8 @@ where
28392826 is_initiator: self.funding.is_outbound(),
28402827 funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
28412828 inputs_to_contribute: funding_inputs,
2829+ shared_funding_output: (shared_funding_output, self.dual_funding_context.our_funding_satoshis),
28422830 outputs_to_contribute: funding_outputs,
2843- expected_remote_shared_funding_output,
28442831 };
28452832 let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
28462833 let msg = tx_constructor.take_initiator_first_message();
@@ -12067,6 +12054,10 @@ where
1206712054 funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
1206812055 our_funding_inputs: our_funding_inputs.clone(),
1206912056 };
12057+ let shared_funding_output = TxOut {
12058+ value: Amount::from_sat(funding.get_value_satoshis()),
12059+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
12060+ };
1207012061
1207112062 let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
1207212063 InteractiveTxConstructorArgs {
@@ -12078,8 +12069,8 @@ where
1207812069 funding_tx_locktime: dual_funding_context.funding_tx_locktime,
1207912070 is_initiator: false,
1208012071 inputs_to_contribute: our_funding_inputs,
12072+ shared_funding_output: (shared_funding_output, our_funding_satoshis),
1208112073 outputs_to_contribute: Vec::new(),
12082- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
1208312074 }
1208412075 ).map_err(|_| ChannelError::Close((
1208512076 "V2 channel rejected due to sender error".into(),
0 commit comments