HashCalc uses self.accounts_cache (#23890)

This commit is contained in:
Jeff Washington (jwash)
2022-03-24 10:34:28 -05:00
committed by GitHub
parent f2aea3b7c7
commit 5b916961b5
3 changed files with 11 additions and 14 deletions

View File

@ -119,7 +119,7 @@ impl AccountsHashVerifier {
use_bg_thread_pool: true, use_bg_thread_pool: true,
stats: HashStats::default(), stats: HashStats::default(),
check_hash: false, check_hash: false,
accounts_cache_and_ancestors: None, ancestors: None,
}) })
.unwrap(); .unwrap();

View File

@ -5492,14 +5492,14 @@ impl AccountsDb {
is_startup: bool, is_startup: bool,
) -> Result<(Hash, u64), BankHashVerificationError> { ) -> Result<(Hash, u64), BankHashVerificationError> {
if !use_index { if !use_index {
let accounts_cache_and_ancestors = if can_cached_slot_be_unflushed { let ancestors = if can_cached_slot_be_unflushed {
Some((&self.accounts_cache, ancestors)) Some(ancestors)
} else { } else {
None None
}; };
let mut collect_time = Measure::start("collect"); let mut collect_time = Measure::start("collect");
let (combined_maps, slots) = self.get_snapshot_storages(slot, None, Some(ancestors)); let (combined_maps, slots) = self.get_snapshot_storages(slot, None, ancestors);
collect_time.stop(); collect_time.stop();
let mut sort_time = Measure::start("sort_storages"); let mut sort_time = Measure::start("sort_storages");
@ -5525,7 +5525,7 @@ impl AccountsDb {
use_bg_thread_pool: !is_startup, use_bg_thread_pool: !is_startup,
stats: timings, stats: timings,
check_hash, check_hash,
accounts_cache_and_ancestors, ancestors,
}) })
} else { } else {
self.calculate_accounts_hash(slot, ancestors, check_hash) self.calculate_accounts_hash(slot, ancestors, check_hash)
@ -5754,8 +5754,8 @@ impl AccountsDb {
&bounds, &bounds,
config.check_hash, config.check_hash,
config config
.accounts_cache_and_ancestors .ancestors
.map(|(a, b)| (a, b, &self.accounts_index)), .map(|a| (&self.accounts_cache, a, &self.accounts_index)),
hash.filler_account_suffix.as_ref(), hash.filler_account_suffix.as_ref(),
)?; )?;
@ -7929,7 +7929,7 @@ pub mod tests {
use_bg_thread_pool: false, use_bg_thread_pool: false,
stats: HashStats::default(), stats: HashStats::default(),
check_hash: false, check_hash: false,
accounts_cache_and_ancestors: None, ancestors: None,
}) })
.unwrap(); .unwrap();
let expected_hash = Hash::from_str("GKot5hBsd81kMupNCXHaqbhv3huEbxAFMLnpcX2hniwn").unwrap(); let expected_hash = Hash::from_str("GKot5hBsd81kMupNCXHaqbhv3huEbxAFMLnpcX2hniwn").unwrap();
@ -7953,7 +7953,7 @@ pub mod tests {
use_bg_thread_pool: false, use_bg_thread_pool: false,
stats: HashStats::default(), stats: HashStats::default(),
check_hash: false, check_hash: false,
accounts_cache_and_ancestors: None, ancestors: None,
}) })
.unwrap(); .unwrap();

View File

@ -1,8 +1,5 @@
use { use {
crate::{ crate::{accounts_db::SnapshotStorages, ancestors::Ancestors, sorted_storages::SortedStorages},
accounts_cache::AccountsCache, accounts_db::SnapshotStorages, ancestors::Ancestors,
sorted_storages::SortedStorages,
},
log::*, log::*,
rayon::prelude::*, rayon::prelude::*,
solana_measure::measure::Measure, solana_measure::measure::Measure,
@ -28,7 +25,7 @@ pub struct CalcAccountsHashConfig<'a> {
pub use_bg_thread_pool: bool, pub use_bg_thread_pool: bool,
pub stats: HashStats, pub stats: HashStats,
pub check_hash: bool, pub check_hash: bool,
pub accounts_cache_and_ancestors: Option<(&'a AccountsCache, &'a Ancestors)>, pub ancestors: Option<&'a Ancestors>,
// to come soon // to come soon
/* /*
pub rent_collector: RentCollector, pub rent_collector: RentCollector,