@@ -57,7 +57,7 @@ use crate::ln::channelmanager::{
57
57
use crate::ln::interactivetxs::{
58
58
calculate_change_output_value, get_output_weight, AbortReason, HandleTxCompleteResult,
59
59
InteractiveTxConstructor, InteractiveTxConstructorArgs, InteractiveTxMessageSend,
60
- InteractiveTxMessageSendResult, InteractiveTxSigningSession, OutputOwned, SharedOwnedOutput,
60
+ InteractiveTxMessageSendResult, InteractiveTxSigningSession, SharedOwnedOutput,
61
61
TX_COMMON_FIELDS_WEIGHT,
62
62
};
63
63
use crate::ln::msgs;
@@ -2756,24 +2756,12 @@ where
2756
2756
// Note: For the error case when the inputs are insufficient, it will be handled after
2757
2757
// the `calculate_change_output_value` call below
2758
2758
let mut funding_outputs = Vec::new();
2759
- let mut expected_remote_shared_funding_output = None;
2760
2759
2761
2760
let shared_funding_output = TxOut {
2762
2761
value: Amount::from_sat(self.funding.get_value_satoshis()),
2763
2762
script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
2764
2763
};
2765
2764
2766
- if self.funding.is_outbound() {
2767
- funding_outputs.push(
2768
- OutputOwned::Shared(SharedOwnedOutput::new(
2769
- shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2770
- ))
2771
- );
2772
- } else {
2773
- let TxOut { value, script_pubkey } = shared_funding_output;
2774
- expected_remote_shared_funding_output = Some((script_pubkey, value.to_sat()));
2775
- }
2776
-
2777
2765
// Optionally add change output
2778
2766
let change_script = if let Some(script) = change_destination_opt {
2779
2767
script
@@ -2783,7 +2771,7 @@ where
2783
2771
};
2784
2772
let change_value_opt = calculate_change_output_value(
2785
2773
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2786
- &funding_inputs, &funding_outputs,
2774
+ &shared_funding_output.script_pubkey, & funding_inputs, &funding_outputs,
2787
2775
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2788
2776
change_script.minimal_non_dust().to_sat(),
2789
2777
)?;
@@ -2798,7 +2786,7 @@ where
2798
2786
// Check dust limit again
2799
2787
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
2800
2788
change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2801
- funding_outputs.push(OutputOwned::Single( change_output) );
2789
+ funding_outputs.push(change_output);
2802
2790
}
2803
2791
}
2804
2792
@@ -2811,8 +2799,8 @@ where
2811
2799
is_initiator: self.funding.is_outbound(),
2812
2800
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2813
2801
inputs_to_contribute: funding_inputs,
2802
+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.dual_funding_context.our_funding_satoshis),
2814
2803
outputs_to_contribute: funding_outputs,
2815
- expected_remote_shared_funding_output,
2816
2804
};
2817
2805
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
2818
2806
let msg = tx_constructor.take_initiator_first_message();
@@ -11809,6 +11797,10 @@ where
11809
11797
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
11810
11798
our_funding_inputs: our_funding_inputs.clone(),
11811
11799
};
11800
+ let shared_funding_output = TxOut {
11801
+ value: Amount::from_sat(funding.get_value_satoshis()),
11802
+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
11803
+ };
11812
11804
11813
11805
let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
11814
11806
InteractiveTxConstructorArgs {
@@ -11820,8 +11812,8 @@ where
11820
11812
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
11821
11813
is_initiator: false,
11822
11814
inputs_to_contribute: our_funding_inputs,
11815
+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, our_funding_satoshis),
11823
11816
outputs_to_contribute: Vec::new(),
11824
- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
11825
11817
}
11826
11818
).map_err(|_| ChannelError::Close((
11827
11819
"V2 channel rejected due to sender error".into(),
0 commit comments