From 99ce9a2dd268af51a5f2531a57ae63667bd32ec6 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 20 Oct 2018 19:18:16 +1100 Subject: [PATCH] Add new method for ValidatorInductor --- .../validator_induction/src/inductor.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/beacon_chain/validator_induction/src/inductor.rs b/beacon_chain/validator_induction/src/inductor.rs index 15d2c4449..b18231c87 100644 --- a/beacon_chain/validator_induction/src/inductor.rs +++ b/beacon_chain/validator_induction/src/inductor.rs @@ -24,6 +24,17 @@ pub enum ValidatorInductionError { } impl<'a> ValidatorInductor<'a> { + pub fn new(current_slot: u64, shard_count: u16, validators: &'a mut Vec) + -> Self + { + Self { + current_slot, + shard_count, + validators, + empty_validator_start: 0, + } + } + /// Attempt to induct a validator into the CrystallizedState. /// /// Returns an error if the registration is invalid, otherwise returns the index of the @@ -138,12 +149,10 @@ mod tests { shard_count: u16) -> Result { - let mut inductor = ValidatorInductor { + let mut inductor = ValidatorInductor::new( current_slot, shard_count, - empty_validator_start: 0, - validators, - }; + validators); inductor.induct(&validator_rego) }