From b89b498fd39e4f32055fb4514e2a13aa5408e520 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Mon, 2 Jan 2023 22:53:30 -0600 Subject: [PATCH] filter get_snapshot_storages for requested_slots earlier (#29465) * filter get_snapshot_storages for requested_slots earlier * Update runtime/src/accounts_db.rs Co-authored-by: apfitzge Co-authored-by: apfitzge --- runtime/src/accounts_db.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index fa42c528d29e73..6a327978149532 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -8533,6 +8533,7 @@ impl AccountsDb { .storage .iter() .map(|k| *k.key() as Slot) + .filter(|slot| requested_slots.contains(slot)) .collect::>(); m.stop(); let mut m2 = Measure::start("filter"); @@ -8545,11 +8546,10 @@ impl AccountsDb { slots .iter() .filter_map(|slot| { - if requested_slots.contains(slot) - && (self.accounts_index.is_alive_root(*slot) - || ancestors - .map(|ancestors| ancestors.contains_key(slot)) - .unwrap_or_default()) + if self.accounts_index.is_alive_root(*slot) + || ancestors + .map(|ancestors| ancestors.contains_key(slot)) + .unwrap_or_default() { self.storage.get(slot).map_or_else( || None,