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