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