add 'ticks-per-slot' to 'solana-test-validator' (#22701)

* add 'ticks-per-slot' to 'solana-test-validator'

* add input parser validator for "ticks-per-slot" argument

* fix fmt
This commit is contained in:
Haleem Assal
2022-01-24 16:56:37 -04:00
committed by GitHub
parent 1c10677f82
commit 0562426661
2 changed files with 25 additions and 1 deletions

View File

@ -96,6 +96,7 @@ pub struct TestValidatorGenesis {
no_bpf_jit: bool,
accounts: HashMap<Pubkey, AccountSharedData>,
programs: Vec<ProgramInfo>,
ticks_per_slot: Option<u64>,
epoch_schedule: Option<EpochSchedule>,
node_config: TestValidatorNodeConfig,
pub validator_exit: Arc<RwLock<Exit>>,
@ -128,6 +129,11 @@ impl TestValidatorGenesis {
self
}
pub fn ticks_per_slot(&mut self, ticks_per_slot: u64) -> &mut Self {
self.ticks_per_slot = Some(ticks_per_slot);
self
}
pub fn epoch_schedule(&mut self, epoch_schedule: EpochSchedule) -> &mut Self {
self.epoch_schedule = Some(epoch_schedule);
self
@ -465,6 +471,10 @@ impl TestValidator {
.epoch_schedule
.unwrap_or_else(EpochSchedule::without_warmup);
if let Some(ticks_per_slot) = config.ticks_per_slot {
genesis_config.ticks_per_slot = ticks_per_slot;
}
let ledger_path = match &config.ledger_path {
None => create_new_tmp_ledger!(&genesis_config).0,
Some(ledger_path) => {