cleanup of allocate_accounts_index (#19585)

This commit is contained in:
Jeff Washington (jwash) 2021-09-02 17:58:07 -05:00 committed by GitHub
parent 78585a992b
commit 682daf1117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -830,11 +830,12 @@ impl<T: IsCached> AccountsIndex<T> {
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::<Vec<_>>();
let bin_calculator = PubkeyBinCalculator16::new(bins);
(account_maps, bin_calculator)
}