minor optimize process_active_validator: avoid a call to state.get_validator (#4608)

This commit is contained in:
zhiqiangxu 2023-08-14 00:29:45 +00:00
parent 9d8b2764ef
commit 501ce62d7c

View File

@ -111,8 +111,8 @@ impl SingleEpochParticipationCache {
current_epoch: Epoch, current_epoch: Epoch,
relative_epoch: RelativeEpoch, relative_epoch: RelativeEpoch,
) -> Result<(), BeaconStateError> { ) -> Result<(), BeaconStateError> {
let val_balance = state.get_effective_balance(val_index)?;
let validator = state.get_validator(val_index)?; let validator = state.get_validator(val_index)?;
let val_balance = validator.effective_balance;
// Sanity check to ensure the validator is active. // Sanity check to ensure the validator is active.
let epoch = relative_epoch.into_epoch(current_epoch); let epoch = relative_epoch.into_epoch(current_epoch);