add epoch_schedule and rent_collector to hash calc (#24012)
This commit is contained in:
committed by
GitHub
parent
da001d54e5
commit
9c8dad33c7
@ -13,6 +13,7 @@ use {
|
||||
accounts_index::{AccountSecondaryIndexes, ScanConfig},
|
||||
ancestors::Ancestors,
|
||||
bank::*,
|
||||
rent_collector::RentCollector,
|
||||
},
|
||||
solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount},
|
||||
@ -20,6 +21,7 @@ use {
|
||||
hash::Hash,
|
||||
lamports::LamportsError,
|
||||
pubkey::Pubkey,
|
||||
sysvar::epoch_schedule::EpochSchedule,
|
||||
},
|
||||
std::{
|
||||
collections::{HashMap, HashSet},
|
||||
@ -107,7 +109,12 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
||||
let slot = 0;
|
||||
create_test_accounts(&accounts, &mut pubkeys, num_accounts, slot);
|
||||
let ancestors = Ancestors::from(vec![0]);
|
||||
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(0, &ancestors);
|
||||
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(
|
||||
0,
|
||||
&ancestors,
|
||||
&EpochSchedule::default(),
|
||||
&RentCollector::default(),
|
||||
);
|
||||
let test_hash_calculation = false;
|
||||
bencher.iter(|| {
|
||||
assert!(accounts.verify_bank_hash_and_lamports(
|
||||
@ -115,8 +122,8 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
||||
&ancestors,
|
||||
total_lamports,
|
||||
test_hash_calculation,
|
||||
None,
|
||||
None,
|
||||
&EpochSchedule::default(),
|
||||
&RentCollector::default()
|
||||
))
|
||||
});
|
||||
}
|
||||
@ -135,7 +142,12 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
|
||||
create_test_accounts(&accounts, &mut pubkeys, 50_000, 0);
|
||||
let ancestors = Ancestors::from(vec![0]);
|
||||
bencher.iter(|| {
|
||||
accounts.accounts_db.update_accounts_hash(0, &ancestors);
|
||||
accounts.accounts_db.update_accounts_hash(
|
||||
0,
|
||||
&ancestors,
|
||||
&EpochSchedule::default(),
|
||||
&RentCollector::default(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user