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

@@ -104,13 +104,13 @@ pub fn process_activations<T: EthSpec>(
.get(index)
.copied()
.ok_or(Error::BalancesOutOfBounds(index))?;
validator.effective_balance = std::cmp::min(
validator.mutable.effective_balance = std::cmp::min(
balance.safe_sub(balance.safe_rem(spec.effective_balance_increment)?)?,
spec.max_effective_balance,
);
if validator.effective_balance == spec.max_effective_balance {
validator.activation_eligibility_epoch = T::genesis_epoch();
validator.activation_epoch = T::genesis_epoch();
if validator.effective_balance() == spec.max_effective_balance {
validator.mutable.activation_eligibility_epoch = T::genesis_epoch();
validator.mutable.activation_epoch = T::genesis_epoch();
}
}
Ok(())