Add --slots-per-epoch argument

This commit is contained in:
Michael Vines
2021-03-17 11:27:48 -07:00
committed by mergify[bot]
parent c06ff47a90
commit 04c99cf7ea
2 changed files with 32 additions and 1 deletions

View File

@ -16,6 +16,7 @@ use {
account::{Account, AccountSharedData},
clock::{Slot, DEFAULT_MS_PER_SLOT},
commitment_config::CommitmentConfig,
epoch_schedule::EpochSchedule,
fee_calculator::{FeeCalculator, FeeRateGovernor},
hash::Hash,
native_token::sol_to_lamports,
@ -52,6 +53,7 @@ pub struct TestValidatorGenesis {
no_bpf_jit: bool,
accounts: HashMap<Pubkey, AccountSharedData>,
programs: Vec<ProgramInfo>,
epoch_schedule: Option<EpochSchedule>,
pub validator_exit: Arc<RwLock<ValidatorExit>>,
pub start_progress: Arc<RwLock<ValidatorStartProgress>>,
}
@ -72,6 +74,11 @@ impl TestValidatorGenesis {
self
}
pub fn epoch_schedule(&mut self, epoch_schedule: EpochSchedule) -> &mut Self {
self.epoch_schedule = Some(epoch_schedule);
self
}
pub fn rent(&mut self, rent: Rent) -> &mut Self {
self.rent = rent;
self
@ -313,7 +320,9 @@ impl TestValidator {
solana_sdk::genesis_config::ClusterType::Development,
accounts.into_iter().collect(),
);
genesis_config.epoch_schedule = solana_sdk::epoch_schedule::EpochSchedule::without_warmup();
genesis_config.epoch_schedule = config
.epoch_schedule
.unwrap_or_else(EpochSchedule::without_warmup);
let ledger_path = match &config.ledger_path {
None => create_new_tmp_ledger!(&genesis_config).0,