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