add epoch_schedule and rent_collector to hash calc (#23857)

This commit is contained in:
Jeff Washington (jwash)
2022-03-24 09:39:22 -05:00
committed by GitHub
parent db5d68f01f
commit f1a411c897
5 changed files with 49 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ use {
pubkey::Pubkey,
slot_hashes::SlotHashes,
system_program,
sysvar::{self, instructions::construct_instructions_data},
sysvar::{self, epoch_schedule::EpochSchedule, instructions::construct_instructions_data},
transaction::{Result, SanitizedTransaction, TransactionAccountLocks, TransactionError},
transaction_context::TransactionAccount,
},
@@ -747,6 +747,8 @@ impl Accounts {
slot: Slot,
can_cached_slot_be_unflushed: bool,
debug_verify: bool,
epoch_schedule: Option<&EpochSchedule>,
rent_collector: Option<&RentCollector>,
) -> u64 {
let use_index = false;
let is_startup = false; // there may be conditions where this is called at startup.
@@ -758,7 +760,8 @@ impl Accounts {
ancestors,
None,
can_cached_slot_be_unflushed,
None,
epoch_schedule,
rent_collector,
is_startup,
)
.1
@@ -772,12 +775,16 @@ impl Accounts {
ancestors: &Ancestors,
total_lamports: u64,
test_hash_calculation: bool,
epoch_schedule: Option<&EpochSchedule>,
rent_collector: Option<&RentCollector>,
) -> bool {
if let Err(err) = self.accounts_db.verify_bank_hash_and_lamports(
if let Err(err) = self.accounts_db.verify_bank_hash_and_lamports_new(
slot,
ancestors,
total_lamports,
test_hash_calculation,
epoch_schedule,
rent_collector,
) {
warn!("verify_bank_hash failed: {:?}", err);
false