From 22342134ef968a2147f14b3c6a8ad193de824174 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 26 Apr 2018 19:43:50 -0400 Subject: [PATCH] Some with_capacity's --- src/ln/channel.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ln/channel.rs b/src/ln/channel.rs index 7c9e6907..86855c1b 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 { -- 2.30.2