@@ -2269,24 +2269,24 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
2269
2269
};
2270
2270
2271
2271
// Optionally add change output
2272
+ let change_script = if let Some(script) = change_destination_opt {
2273
+ script
2274
+ } else {
2275
+ signer_provider.get_destination_script(self.context.channel_keys_id)
2276
+ .map_err(|err| ChannelError::Warn(format!(
2277
+ "Failed to get change script as new destination script, {:?}", err,
2278
+ )))?
2279
+ };
2272
2280
let change_value_opt = calculate_change_output_value(
2273
2281
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2274
2282
&funding_inputs_prev_outputs, &funding_outputs,
2275
2283
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2276
- self.context.holder_dust_limit_satoshis ,
2284
+ change_script.minimal_non_dust().to_sat() ,
2277
2285
).map_err(|err| ChannelError::Warn(format!(
2278
2286
"Insufficient inputs, cannot cover intended contribution of {} and fees; {}",
2279
2287
self.dual_funding_context.our_funding_satoshis, err
2280
2288
)))?;
2281
2289
if let Some(change_value) = change_value_opt {
2282
- let change_script = if let Some(script) = change_destination_opt {
2283
- script
2284
- } else {
2285
- signer_provider.get_destination_script(self.context.channel_keys_id)
2286
- .map_err(|err| ChannelError::Warn(format!(
2287
- "Failed to get change script as new destination script, {:?}", err,
2288
- )))?
2289
- };
2290
2290
let mut change_output = TxOut {
2291
2291
value: Amount::from_sat(change_value),
2292
2292
script_pubkey: change_script,
0 commit comments