Skip to content

Commit

Permalink
Don't error on inactive indices in att. rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jan 13, 2024
1 parent 9cd9243 commit 6262be7
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions beacon_node/beacon_chain/src/attestation_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,25 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
};

for &validator_index in &validators {
let validator = participation_cache
.get_validator(validator_index)
.map_err(|_| BeaconChainError::AttestationRewardsError)?;
// Return 0s for unknown/inactive validator indices. This is a bit different from stable
// where we error for unknown pubkeys.
let Ok(validator) = participation_cache.get_validator(validator_index) else {
debug!(
self.log,
"No rewards for inactive/unknown validator";
"index" => validator_index,
"epoch" => previous_epoch
);
total_rewards.push(TotalAttestationRewards {
validator_index: validator_index as u64,
head: 0,
target: 0,
source: 0,
inclusion_delay: None,
inactivity: 0,
});
continue;
};
let eligible = validator.is_eligible;
let mut head_reward = 0i64;
let mut target_reward = 0i64;
Expand Down

0 comments on commit 6262be7

Please sign in to comment.