From 98714817efbf60bc7fe9f4f752af38aaf6dd5dd7 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 18 May 2023 17:59:02 +0000 Subject: [PATCH] avoid unneccessary to_vec -> into_iter --- core/src/banking_stage/consumer.rs | 36 +++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index 1a750448c43f60..74e44c96c2b4b6 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -430,27 +430,23 @@ impl Consumer { // Need to filter out transactions since they were sanitized earlier. // This means that the transaction may cross and epoch boundary (not allowed), // or account lookup tables may have been closed. - let pre_results = txs - .iter() - .zip(max_slot_ages) - .map(|(tx, max_slot_age)| { - if *max_slot_age < bank.slot() { - // Attempt re-sanitization after epoch-cross. - // Re-sanitized transaction should be equal to the original transaction, - // but whether it will pass sanitization needs to be checked. - resanitize(tx, bank)?; - } else { - // Any transaction executed between sanitization time and now may have closed the lookup table(s). - // Above re-sanitization already loads addresses, so don't need to re-check in that case. - let lookup_tables = tx.message().message_address_table_lookups(); - if !lookup_tables.is_empty() { - bank.load_addresses(lookup_tables)?; - } + let pre_results = txs.iter().zip(max_slot_ages).map(|(tx, max_slot_age)| { + if *max_slot_age < bank.slot() { + // Attempt re-sanitization after epoch-cross. + // Re-sanitized transaction should be equal to the original transaction, + // but whether it will pass sanitization needs to be checked. + resanitize(tx, bank)?; + } else { + // Any transaction executed between sanitization time and now may have closed the lookup table(s). + // Above re-sanitization already loads addresses, so don't need to re-check in that case. + let lookup_tables = tx.message().message_address_table_lookups(); + if !lookup_tables.is_empty() { + bank.load_addresses(lookup_tables)?; } - Ok(()) - }) - .collect_vec(); - self.process_and_record_transactions_with_pre_results(bank, txs, 0, pre_results.into_iter()) + } + Ok(()) + }); + self.process_and_record_transactions_with_pre_results(bank, txs, 0, pre_results) } fn process_and_record_transactions_with_pre_results(