Allow for customizable recent genesis window

This commit is contained in:
Paul Hauner
2019-08-29 14:59:32 +10:00
parent 3acd75f876
commit 314780e634
5 changed files with 37 additions and 10 deletions

View File

@@ -42,7 +42,10 @@ pub enum BeaconChainStartMethod {
/// Create a new beacon chain that can connect to mainnet.
///
/// Set the genesis time to be the start of the previous 30-minute window.
RecentGenesis { validator_count: usize },
RecentGenesis {
validator_count: usize,
minutes: u64,
},
/// Create a new beacon chain with `genesis_time` and `validator_count` validators, all with well-known
/// secret keys.
Generated {

View File

@@ -88,9 +88,15 @@ where
crit!(log, "No mainnet beacon chain startup specification.");
return Err("Mainnet is not yet specified. We're working on it.".into());
}
BeaconChainStartMethod::RecentGenesis { validator_count } => {
BeaconChainBuilder::recent_genesis(*validator_count, spec.clone(), log.clone())
}
BeaconChainStartMethod::RecentGenesis {
validator_count,
minutes,
} => BeaconChainBuilder::recent_genesis(
*validator_count,
*minutes,
spec.clone(),
log.clone(),
),
BeaconChainStartMethod::Generated {
validator_count,
genesis_time,