begin the transition to using ValidatorStatus as a distinct type

This commit is contained in:
Alex Stokes
2018-12-11 15:17:55 -08:00
parent d3681e876a
commit fa3d9bdb07
4 changed files with 36 additions and 21 deletions

View File

@@ -62,7 +62,7 @@ pub fn update_validator_set(
/*
* Validator is pending activiation.
*/
x if x == ValidatorStatus::PendingActivation as u8 => {
x if x == ValidatorStatus::PendingActivation => {
let new_total_changed = total_changed
.checked_add(deposit_size_gwei)
.ok_or(UpdateValidatorSetError::ArithmeticOverflow)?;
@@ -71,7 +71,7 @@ pub fn update_validator_set(
* activate the validator.
*/
if new_total_changed <= max_allowable_change {
v.status = ValidatorStatus::Active as u8;
v.status = ValidatorStatus::Active;
hasher.extend(i, &v.pubkey.as_bytes(), VALIDATOR_FLAG_ENTRY);
total_changed = new_total_changed;
} else {
@@ -82,7 +82,7 @@ pub fn update_validator_set(
/*
* Validator is pending exit.
*/
x if x == ValidatorStatus::PendingExit as u8 => {
x if x == ValidatorStatus::PendingExit => {
let new_total_changed = total_changed
.checked_add(v.balance)
.ok_or(UpdateValidatorSetError::ArithmeticOverflow)?;
@@ -91,7 +91,7 @@ pub fn update_validator_set(
* exit the validator
*/
if new_total_changed <= max_allowable_change {
v.status = ValidatorStatus::PendingWithdraw as u8;
v.status = ValidatorStatus::PendingWithdraw;
v.exit_slot = present_slot;
hasher.extend(i, &v.pubkey.as_bytes(), VALIDATOR_FLAG_EXIT);
total_changed = new_total_changed;