Skip to content

Commit ac74de5

Browse files
committed
Fix attestation performance api
1 parent 1322c5b commit ac74de5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

beacon_node/http_api/src/attestation_performance.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ pub fn get_attestation_performance<T: BeaconChainTypes>(
8383
}
8484

8585
// Either use the global validator set, or the specified index.
86+
//
87+
// Does no further validation of the indices, so in the event an index has not yet been
88+
// activated or does not yet exist (according to the head state), it will return all fields as
89+
// `false`.
8690
let index_range = if target.to_lowercase() == "global" {
8791
chain
8892
.with_head(|head| Ok((0..head.beacon_state.validators().len() as u64).collect()))
@@ -159,11 +163,17 @@ pub fn get_attestation_performance<T: BeaconChainTypes>(
159163

160164
let is_active = summary.is_active_unslashed_in_previous_epoch(index);
161165

162-
let received_source_reward = summary.is_previous_epoch_source_attester(index)?;
166+
let received_source_reward = summary
167+
.is_previous_epoch_source_attester(index)
168+
.unwrap_or(false);
163169

164-
let received_head_reward = summary.is_previous_epoch_head_attester(index)?;
170+
let received_head_reward = summary
171+
.is_previous_epoch_head_attester(index)
172+
.unwrap_or(false);
165173

166-
let received_target_reward = summary.is_previous_epoch_target_attester(index)?;
174+
let received_target_reward = summary
175+
.is_previous_epoch_target_attester(index)
176+
.unwrap_or(false);
167177

168178
let inclusion_delay = summary
169179
.previous_epoch_inclusion_info(index)

0 commit comments

Comments
 (0)