Skip to content

Commit 07d157b

Browse files
committed
f - move change script generation
1 parent d373d25 commit 07d157b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5831,21 +5831,21 @@ impl FundingNegotiationContext {
58315831

58325832
// Optionally add change output
58335833
if self.our_funding_contribution_satoshis > 0 {
5834-
let change_script = if let Some(script) = change_destination_opt {
5835-
script
5836-
} else {
5837-
signer_provider.get_destination_script(context.channel_keys_id).map_err(|_err| {
5838-
AbortReason::InternalError("Error getting destination script")
5839-
})?
5840-
};
58415834
let change_value_opt = calculate_change_output_value(
58425835
&self,
58435836
funding.channel_transaction_parameters.splice_parent_funding_txid.is_some(),
58445837
&shared_funding_output.script_pubkey,
58455838
&funding_outputs,
5846-
change_script.minimal_non_dust().to_sat(),
5839+
context.holder_dust_limit_satoshis,
58475840
)?;
58485841
if let Some(change_value) = change_value_opt {
5842+
let change_script = if let Some(script) = change_destination_opt {
5843+
script
5844+
} else {
5845+
signer_provider.get_destination_script(context.channel_keys_id).map_err(|_err| {
5846+
AbortReason::InternalError("Error getting destination script")
5847+
})?
5848+
};
58495849
let mut change_output =
58505850
TxOut { value: Amount::from_sat(change_value), script_pubkey: change_script };
58515851
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();

0 commit comments

Comments
 (0)