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:
@ -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) => {
|
||||
|
Reference in New Issue
Block a user