From: Matt Corallo Date: Thu, 26 Apr 2018 23:43:50 +0000 (-0400) Subject: Some with_capacity's X-Git-Tag: v0.0.12~408^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=22342134ef968a2147f14b3c6a8ad193de824174;p=rust-lightning Some with_capacity's --- diff --git a/src/ln/channel.rs b/src/ln/channel.rs index 7c9e69074..86855c1b8 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -608,7 +608,7 @@ impl Channel { ins }; - let mut txouts: Vec<(TxOut, Option)> = Vec::new(); + let mut txouts: Vec<(TxOut, Option)> = Vec::with_capacity(self.pending_htlcs.len() + 2); let dust_limit_satoshis = if local { self.our_dust_limit_satoshis } else { self.their_dust_limit_satoshis }; let mut remote_htlc_total_msat = 0; @@ -699,8 +699,8 @@ impl Channel { transaction_utils::sort_outputs(&mut txouts); - let mut outputs: Vec = Vec::new(); - let mut htlcs_used: Vec = Vec::new(); + let mut outputs: Vec = Vec::with_capacity(txouts.len()); + let mut htlcs_used: Vec = Vec::with_capacity(txouts.len()); for (idx, out) in txouts.drain(..).enumerate() { outputs.push(out.0); if let Some(out_htlc) = out.1 {