From a20c1388159bb5ed6e0d82c2e81e5eff648f32f7 Mon Sep 17 00:00:00 2001 From: Brennan Date: Mon, 25 Nov 2024 16:22:09 -0800 Subject: [PATCH] get rid of intermediate collect (#3788) --- .../transaction_scheduler/scheduler_controller.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 97f828c186f33e..8382a1d48c2c2e 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -220,17 +220,14 @@ impl SchedulerController { &mut error_counters, ); - let fee_check_results: Vec<_> = check_results + for ((check_result, tx), result) in check_results .into_iter() .zip(transactions) - .map(|(result, tx)| { - result?; // if there's already error do nothing - Consumer::check_fee_payer_unlocked(bank, *tx, &mut error_counters) - }) - .collect(); - - for (fee_check_result, result) in fee_check_results.into_iter().zip(results.iter_mut()) { - *result = fee_check_result.is_ok(); + .zip(results.iter_mut()) + { + *result = check_result + .and_then(|_| Consumer::check_fee_payer_unlocked(bank, *tx, &mut error_counters)) + .is_ok(); } }