@@ -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,
61
61
TX_COMMON_FIELDS_WEIGHT,
62
62
};
63
63
use crate::ln::msgs;
@@ -2628,24 +2628,12 @@ where
2628
2628
// Note: For the error case when the inputs are insufficient, it will be handled after
2629
2629
// the `calculate_change_output_value` call below
2630
2630
let mut funding_outputs = Vec::new();
2631
- let mut expected_remote_shared_funding_output = None;
2632
2631
2633
2632
let shared_funding_output = TxOut {
2634
2633
value: Amount::from_sat(self.funding.get_value_satoshis()),
2635
2634
script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
2636
2635
};
2637
2636
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
-
2649
2637
// Optionally add change output
2650
2638
let change_script = if let Some(script) = change_destination_opt {
2651
2639
script
@@ -2655,7 +2643,7 @@ where
2655
2643
};
2656
2644
let change_value_opt = calculate_change_output_value(
2657
2645
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,
2659
2647
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2660
2648
change_script.minimal_non_dust().to_sat(),
2661
2649
)?;
@@ -2670,7 +2658,7 @@ where
2670
2658
// Check dust limit again
2671
2659
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
2672
2660
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);
2674
2662
}
2675
2663
}
2676
2664
@@ -2683,8 +2671,8 @@ where
2683
2671
is_initiator: self.funding.is_outbound(),
2684
2672
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2685
2673
inputs_to_contribute: funding_inputs,
2674
+ shared_funding_output: (shared_funding_output, self.dual_funding_context.our_funding_satoshis),
2686
2675
outputs_to_contribute: funding_outputs,
2687
- expected_remote_shared_funding_output,
2688
2676
};
2689
2677
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
2690
2678
let msg = tx_constructor.take_initiator_first_message();
@@ -11051,6 +11039,10 @@ where
11051
11039
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
11052
11040
our_funding_inputs: our_funding_inputs.clone(),
11053
11041
};
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
+ };
11054
11046
11055
11047
let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
11056
11048
InteractiveTxConstructorArgs {
@@ -11062,8 +11054,8 @@ where
11062
11054
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
11063
11055
is_initiator: false,
11064
11056
inputs_to_contribute: our_funding_inputs,
11057
+ shared_funding_output: (shared_funding_output, our_funding_satoshis),
11065
11058
outputs_to_contribute: Vec::new(),
11066
- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
11067
11059
}
11068
11060
).map_err(|_| ChannelError::Close((
11069
11061
"V2 channel rejected due to sender error".into(),
0 commit comments