Don't wait for EAH unless feature is enabled (#28938)
This commit is contained in:
parent
bee24a81b8
commit
04016e3bcf
|
@ -7787,22 +7787,28 @@ impl Bank {
|
|||
/// EAH *must* be included. This means if an EAH calculation is currently in-flight we will
|
||||
/// wait for it to complete.
|
||||
pub fn get_epoch_accounts_hash_to_serialize(&self) -> Option<EpochAccountsHash> {
|
||||
let should_get_epoch_accounts_hash = epoch_accounts_hash::is_enabled_this_epoch(self)
|
||||
let should_get_epoch_accounts_hash = self
|
||||
.feature_set
|
||||
.is_active(&feature_set::epoch_accounts_hash::id())
|
||||
&& epoch_accounts_hash::is_enabled_this_epoch(self)
|
||||
&& epoch_accounts_hash::is_in_calculation_window(self);
|
||||
let (epoch_accounts_hash, measure) = measure!(should_get_epoch_accounts_hash.then(|| {
|
||||
self.rc
|
||||
.accounts
|
||||
.accounts_db
|
||||
.epoch_accounts_hash_manager
|
||||
.wait_get_epoch_accounts_hash()
|
||||
}));
|
||||
if !should_get_epoch_accounts_hash {
|
||||
return None;
|
||||
}
|
||||
|
||||
let (epoch_accounts_hash, measure) = measure!(self
|
||||
.rc
|
||||
.accounts
|
||||
.accounts_db
|
||||
.epoch_accounts_hash_manager
|
||||
.wait_get_epoch_accounts_hash());
|
||||
|
||||
datapoint_info!(
|
||||
"bank-get_epoch_accounts_hash_to_serialize",
|
||||
("slot", self.slot(), i64),
|
||||
("waiting-time-us", measure.as_us(), i64),
|
||||
);
|
||||
epoch_accounts_hash
|
||||
Some(epoch_accounts_hash)
|
||||
}
|
||||
|
||||
/// Convenience fn to get the Epoch Accounts Hash
|
||||
|
|
|
@ -8,7 +8,7 @@ use {
|
|||
append_vec::AppendVec,
|
||||
bank::{Bank, Rewrites},
|
||||
epoch_accounts_hash,
|
||||
genesis_utils::{activate_all_features, activate_feature},
|
||||
genesis_utils::{self, activate_all_features, activate_feature},
|
||||
snapshot_utils::ArchiveFormat,
|
||||
status_cache::StatusCache,
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ use {
|
|||
solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount},
|
||||
clock::Slot,
|
||||
feature_set::disable_fee_calculator,
|
||||
feature_set::{self, disable_fee_calculator},
|
||||
genesis_config::{create_genesis_config, ClusterType},
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
|
@ -228,6 +228,7 @@ fn test_bank_serialize_style(
|
|||
) {
|
||||
solana_logger::setup();
|
||||
let (mut genesis_config, _) = create_genesis_config(500);
|
||||
genesis_utils::activate_feature(&mut genesis_config, feature_set::epoch_accounts_hash::id());
|
||||
genesis_config.epoch_schedule = EpochSchedule::custom(400, 400, false);
|
||||
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
|
||||
let eah_start_slot = epoch_accounts_hash::calculation_start(&bank0);
|
||||
|
|
Loading…
Reference in New Issue