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

@ -14,6 +14,7 @@ use {
solana_sdk::{
account::AccountSharedData,
clock::Slot,
epoch_schedule::EpochSchedule,
native_token::sol_to_lamports,
pubkey::Pubkey,
rpc_port,
@ -146,6 +147,17 @@ fn main() {
.takes_value(false)
.help("Disable the just-in-time compiler and instead use the interpreter for BPF"),
)
.arg(
Arg::with_name("slots_per_epoch")
.long("slots-per-epoch")
.value_name("SLOTS")
.validator(is_slot)
.takes_value(true)
.help(
"Override the number of slots in an epoch. \
If the ledger already exists then this parameter is silently ignored",
),
)
.arg(
Arg::with_name("clone_account")
.long("clone")
@ -205,6 +217,7 @@ fn main() {
Output::Dashboard
};
let rpc_port = value_t_or_exit!(matches, "rpc_port", u16);
let slots_per_epoch = value_t!(matches, "slots_per_epoch", Slot).ok();
let faucet_addr = Some(SocketAddr::new(
IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
@ -359,6 +372,7 @@ fn main() {
("bpf_program", "--bpf-program"),
("clone_account", "--clone"),
("mint_address", "--mint"),
("slots_per_epoch", "--slots-per-epoch"),
] {
if matches.is_present(name) {
println!("{} argument ignored, ledger already exists", long);
@ -422,6 +436,14 @@ fn main() {
genesis.warp_slot(warp_slot);
}
if let Some(slots_per_epoch) = slots_per_epoch {
genesis.epoch_schedule(EpochSchedule::custom(
slots_per_epoch,
slots_per_epoch,
/* enable_warmup_epochs = */ false,
));
}
match genesis.start_with_mint_address(mint_address) {
Ok(test_validator) => {
if let Some(dashboard) = dashboard {