Make VerifyAccountsHashConfig private (#31235)
This commit is contained in:
parent
2b2eccfff9
commit
f5fe2607b6
|
@ -25,7 +25,7 @@ use {
|
||||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||||
bank::{
|
bank::{
|
||||||
Bank, TransactionBalancesSet, TransactionExecutionDetails, TransactionExecutionResult,
|
Bank, TransactionBalancesSet, TransactionExecutionDetails, TransactionExecutionResult,
|
||||||
TransactionResults, VerifyAccountsHashConfig,
|
TransactionResults,
|
||||||
},
|
},
|
||||||
bank_forks::BankForks,
|
bank_forks::BankForks,
|
||||||
bank_utils,
|
bank_utils,
|
||||||
|
@ -1554,7 +1554,7 @@ fn load_frozen_forks(
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
if done_processing {
|
if done_processing {
|
||||||
if opts.run_final_accounts_hash_calc {
|
if opts.run_final_accounts_hash_calc {
|
||||||
run_final_hash_calc(&bank, on_halt_store_hash_raw_data_for_debug);
|
bank.run_final_hash_calc(on_halt_store_hash_raw_data_for_debug);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1569,30 +1569,16 @@ fn load_frozen_forks(
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
} else if on_halt_store_hash_raw_data_for_debug {
|
} else if on_halt_store_hash_raw_data_for_debug {
|
||||||
run_final_hash_calc(
|
bank_forks
|
||||||
&bank_forks.read().unwrap().root_bank(),
|
.read()
|
||||||
on_halt_store_hash_raw_data_for_debug,
|
.unwrap()
|
||||||
);
|
.root_bank()
|
||||||
|
.run_final_hash_calc(on_halt_store_hash_raw_data_for_debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(total_slots_elapsed)
|
Ok(total_slots_elapsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_final_hash_calc(bank: &Bank, on_halt_store_hash_raw_data_for_debug: bool) {
|
|
||||||
bank.force_flush_accounts_cache();
|
|
||||||
// note that this slot may not be a root
|
|
||||||
let _ = bank.verify_accounts_hash(
|
|
||||||
None,
|
|
||||||
VerifyAccountsHashConfig {
|
|
||||||
test_hash_calculation: false,
|
|
||||||
ignore_mismatch: true,
|
|
||||||
require_rooted_bank: false,
|
|
||||||
run_in_background: false,
|
|
||||||
store_hash_raw_data_for_debug: on_halt_store_hash_raw_data_for_debug,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// `roots` is sorted largest to smallest by root slot
|
// `roots` is sorted largest to smallest by root slot
|
||||||
fn supermajority_root(roots: &[(Slot, u64)], total_epoch_stake: u64) -> Option<Slot> {
|
fn supermajority_root(roots: &[(Slot, u64)], total_epoch_stake: u64) -> Option<Slot> {
|
||||||
if roots.is_empty() {
|
if roots.is_empty() {
|
||||||
|
|
|
@ -187,12 +187,12 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// params to `verify_accounts_hash`
|
/// params to `verify_accounts_hash`
|
||||||
pub struct VerifyAccountsHashConfig {
|
struct VerifyAccountsHashConfig {
|
||||||
pub test_hash_calculation: bool,
|
test_hash_calculation: bool,
|
||||||
pub ignore_mismatch: bool,
|
ignore_mismatch: bool,
|
||||||
pub require_rooted_bank: bool,
|
require_rooted_bank: bool,
|
||||||
pub run_in_background: bool,
|
run_in_background: bool,
|
||||||
pub store_hash_raw_data_for_debug: bool,
|
store_hash_raw_data_for_debug: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
mod address_lookup_table;
|
mod address_lookup_table;
|
||||||
|
@ -7013,12 +7013,27 @@ impl Bank {
|
||||||
epoch_accounts_hash
|
epoch_accounts_hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn run_final_hash_calc(&self, on_halt_store_hash_raw_data_for_debug: bool) {
|
||||||
|
self.force_flush_accounts_cache();
|
||||||
|
// note that this slot may not be a root
|
||||||
|
_ = self.verify_accounts_hash(
|
||||||
|
None,
|
||||||
|
VerifyAccountsHashConfig {
|
||||||
|
test_hash_calculation: false,
|
||||||
|
ignore_mismatch: true,
|
||||||
|
require_rooted_bank: false,
|
||||||
|
run_in_background: false,
|
||||||
|
store_hash_raw_data_for_debug: on_halt_store_hash_raw_data_for_debug,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Recalculate the hash_internal_state from the account stores. Would be used to verify a
|
/// Recalculate the hash_internal_state from the account stores. Would be used to verify a
|
||||||
/// snapshot.
|
/// snapshot.
|
||||||
/// return true if all is good
|
/// return true if all is good
|
||||||
/// Only called from startup or test code.
|
/// Only called from startup or test code.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn verify_accounts_hash(
|
fn verify_accounts_hash(
|
||||||
&self,
|
&self,
|
||||||
base: Option<(Slot, /*capitalization*/ u64)>,
|
base: Option<(Slot, /*capitalization*/ u64)>,
|
||||||
config: VerifyAccountsHashConfig,
|
config: VerifyAccountsHashConfig,
|
||||||
|
|
Loading…
Reference in New Issue