X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Fchannel.rs;h=86855c1b82f40c5b92b9fe89ccee381db056a674;hb=d7b33fcd847f5480e438b2df176449d73f582090;hp=7c9e69074e9848e9ffa461225518c598bd76641e;hpb=3057df26566f9b111db0470563689f5633ebfaec;p=rust-lightning 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 {