Add new method for ValidatorInductor
This commit is contained in:
		
							parent
							
								
									b4566a776a
								
							
						
					
					
						commit
						99ce9a2dd2
					
				| @ -24,6 +24,17 @@ pub enum ValidatorInductionError { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl<'a> ValidatorInductor<'a> { | impl<'a> ValidatorInductor<'a> { | ||||||
|  |     pub fn new(current_slot: u64, shard_count: u16, validators: &'a mut Vec<ValidatorRecord>) | ||||||
|  |         -> Self | ||||||
|  |     { | ||||||
|  |         Self { | ||||||
|  |             current_slot, | ||||||
|  |             shard_count, | ||||||
|  |             validators, | ||||||
|  |             empty_validator_start: 0, | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /// Attempt to induct a validator into the CrystallizedState.
 |     /// Attempt to induct a validator into the CrystallizedState.
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// Returns an error if the registration is invalid, otherwise returns the index of the
 |     /// Returns an error if the registration is invalid, otherwise returns the index of the
 | ||||||
| @ -138,12 +149,10 @@ mod tests { | |||||||
|                     shard_count: u16) |                     shard_count: u16) | ||||||
|         -> Result<usize, ValidatorInductionError> |         -> Result<usize, ValidatorInductionError> | ||||||
|     { |     { | ||||||
|         let mut inductor = ValidatorInductor { |         let mut inductor = ValidatorInductor::new( | ||||||
|             current_slot, |             current_slot, | ||||||
|             shard_count, |             shard_count, | ||||||
|             empty_validator_start: 0, |             validators); | ||||||
|             validators, |  | ||||||
|         }; |  | ||||||
|         inductor.induct(&validator_rego) |         inductor.induct(&validator_rego) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user