Split validator into ValidatorMutable

This commit is contained in:
Michael Sproul
2022-09-28 11:43:58 +10:00
parent 9ec454aa52
commit 9a1799f235
22 changed files with 133 additions and 97 deletions

View File

@@ -18,12 +18,12 @@ pub fn slash_validator<T: EthSpec>(
initiate_validator_exit(state, slashed_index, spec)?;
let validator = state.get_validator_mut(slashed_index)?;
validator.slashed = true;
validator.withdrawable_epoch = cmp::max(
validator.withdrawable_epoch,
validator.mutable.slashed = true;
validator.mutable.withdrawable_epoch = cmp::max(
validator.withdrawable_epoch(),
epoch.safe_add(T::EpochsPerSlashingsVector::to_u64())?,
);
let validator_effective_balance = validator.effective_balance;
let validator_effective_balance = validator.effective_balance();
state.set_slashings(
epoch,
state