@@ -58,7 +58,7 @@ use crate::ln::channelmanager::{
58
58
use crate::ln::interactivetxs::{
59
59
calculate_change_output_value, get_output_weight, AbortReason, HandleTxCompleteResult,
60
60
InteractiveTxConstructor, InteractiveTxConstructorArgs, InteractiveTxMessageSend,
61
- InteractiveTxMessageSendResult, InteractiveTxSigningSession, OutputOwned, SharedOwnedOutput,
61
+ InteractiveTxMessageSendResult, InteractiveTxSigningSession, SharedOwnedOutput,
62
62
TX_COMMON_FIELDS_WEIGHT,
63
63
};
64
64
use crate::ln::msgs;
@@ -2785,24 +2785,12 @@ where
2785
2785
// Note: For the error case when the inputs are insufficient, it will be handled after
2786
2786
// the `calculate_change_output_value` call below
2787
2787
let mut funding_outputs = Vec::new();
2788
- let mut expected_remote_shared_funding_output = None;
2789
2788
2790
2789
let shared_funding_output = TxOut {
2791
2790
value: Amount::from_sat(self.funding.get_value_satoshis()),
2792
2791
script_pubkey: self.funding.get_funding_redeemscript().to_p2wsh(),
2793
2792
};
2794
2793
2795
- if self.funding.is_outbound() {
2796
- funding_outputs.push(
2797
- OutputOwned::Shared(SharedOwnedOutput::new(
2798
- shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2799
- ))
2800
- );
2801
- } else {
2802
- let TxOut { value, script_pubkey } = shared_funding_output;
2803
- expected_remote_shared_funding_output = Some((script_pubkey, value.to_sat()));
2804
- }
2805
-
2806
2794
// Optionally add change output
2807
2795
let change_script = if let Some(script) = change_destination_opt {
2808
2796
script
@@ -2812,7 +2800,8 @@ where
2812
2800
};
2813
2801
let change_value_opt = calculate_change_output_value(
2814
2802
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2815
- &funding_inputs, &funding_outputs,
2803
+ &funding_inputs, None,
2804
+ &shared_funding_output.script_pubkey, &funding_outputs,
2816
2805
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2817
2806
change_script.minimal_non_dust().to_sat(),
2818
2807
)?;
@@ -2827,7 +2816,7 @@ where
2827
2816
// Check dust limit again
2828
2817
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
2829
2818
change_output.value = Amount::from_sat(change_value_decreased_with_fee);
2830
- funding_outputs.push(OutputOwned::Single( change_output) );
2819
+ funding_outputs.push(change_output);
2831
2820
}
2832
2821
}
2833
2822
@@ -2840,8 +2829,9 @@ where
2840
2829
is_initiator: self.funding.is_outbound(),
2841
2830
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2842
2831
inputs_to_contribute: funding_inputs,
2832
+ shared_funding_input: None,
2833
+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.dual_funding_context.our_funding_satoshis),
2843
2834
outputs_to_contribute: funding_outputs,
2844
- expected_remote_shared_funding_output,
2845
2835
};
2846
2836
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
2847
2837
let msg = tx_constructor.take_initiator_first_message();
@@ -12036,6 +12026,10 @@ where
12036
12026
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
12037
12027
our_funding_inputs: our_funding_inputs.clone(),
12038
12028
};
12029
+ let shared_funding_output = TxOut {
12030
+ value: Amount::from_sat(funding.get_value_satoshis()),
12031
+ script_pubkey: funding.get_funding_redeemscript().to_p2wsh(),
12032
+ };
12039
12033
12040
12034
let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
12041
12035
InteractiveTxConstructorArgs {
@@ -12047,8 +12041,9 @@ where
12047
12041
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
12048
12042
is_initiator: false,
12049
12043
inputs_to_contribute: our_funding_inputs,
12044
+ shared_funding_input: None,
12045
+ shared_funding_output: SharedOwnedOutput::new(shared_funding_output, our_funding_satoshis),
12050
12046
outputs_to_contribute: Vec::new(),
12051
- expected_remote_shared_funding_output: Some((funding.get_funding_redeemscript().to_p2wsh(), funding.get_value_satoshis())),
12052
12047
}
12053
12048
).map_err(|err| {
12054
12049
let reason = ClosureReason::ProcessingError { err: err.to_string() };
0 commit comments