Skip to content

Commit 3b946ec

Browse files
committed
f Use Vec::with_capacity where possible
1 parent c123e0e commit 3b946ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lightning-transaction-sync/src/electrum.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ where
186186
// First, check the confirmation status of registered transactions as well as the
187187
// status of dependent transactions of registered outputs.
188188
let mut confirmed_txs = Vec::new();
189-
let mut watched_script_pubkeys = Vec::new();
190-
let mut watched_txs = Vec::new();
189+
let mut watched_script_pubkeys = Vec::with_capacity(
190+
sync_state.watched_transactions.len() + sync_state.watched_outputs.len());
191+
let mut watched_txs = Vec::with_capacity(sync_state.watched_transactions.len());
191192
let watched_outputs = sync_state.watched_outputs.values().collect::<Vec<_>>();
192193

193194
for txid in &sync_state.watched_transactions {

0 commit comments

Comments
 (0)