From 682daf11171d984e667360d37dcaa6d9a09aa1fb Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Thu, 2 Sep 2021 17:58:07 -0500 Subject: [PATCH] cleanup of allocate_accounts_index (#19585) --- runtime/src/accounts_index.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index b32ceccab6..3393d3640a 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -830,11 +830,12 @@ impl AccountsIndex { let bins = config .and_then(|config| config.bins) .unwrap_or(BINS_DEFAULT); + // create bin_calculator early to verify # bins is reasonable + let bin_calculator = PubkeyBinCalculator16::new(bins); let account_maps = (0..bins) .into_iter() - .map(|_| RwLock::new(AccountMap::default())) + .map(|_bin| RwLock::new(AccountMap::new())) .collect::>(); - let bin_calculator = PubkeyBinCalculator16::new(bins); (account_maps, bin_calculator) }