Refactor beacon chain start code

This commit is contained in:
Paul Hauner
2019-08-26 14:45:49 +10:00
parent 140c677a38
commit cf435d9653
12 changed files with 161 additions and 227 deletions

View File

@@ -114,7 +114,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// Instantiate a new Beacon Chain, from genesis.
pub fn from_genesis(
store: Arc<T::Store>,
slot_clock: T::SlotClock,
mut genesis_state: BeaconState<T::EthSpec>,
mut genesis_block: BeaconBlock<T::EthSpec>,
spec: ChainSpec,
@@ -147,6 +146,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
"genesis_block_root" => format!("{}", genesis_block_root),
);
// Slot clock
let slot_clock = T::SlotClock::new(
spec.genesis_slot,
genesis_state.genesis_time,
spec.seconds_per_slot,
);
Ok(Self {
spec,
slot_clock,