Skip to content

Commit

Permalink
attester_duties: remove unnecessary case (#4614)
Browse files Browse the repository at this point in the history
Since `tolerant_current_epoch` is expected to be either `current_epoch` or `current_epoch+1`, we can eliminate a case here. 

And added a comment about `compute_historic_attester_duties` , since `RelativeEpoch::from_epoch` will only allow `request_epoch == current_epoch-1` when `request_epoch < current_epoch`.
  • Loading branch information
zhiqiangxu committed Aug 17, 2023
1 parent 1170a09 commit 5b0fa81
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions beacon_node/http_api/src/attester_duties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub fn attester_duties<T: BeaconChainTypes>(
.epoch(T::EthSpec::slots_per_epoch());

if request_epoch == current_epoch
|| request_epoch == tolerant_current_epoch
|| request_epoch == current_epoch + 1
|| request_epoch == tolerant_current_epoch + 1
{
Expand All @@ -46,7 +45,7 @@ pub fn attester_duties<T: BeaconChainTypes>(
request_epoch, current_epoch
)))
} else {
// request_epoch < current_epoch
// request_epoch < current_epoch, in fact we only allow `request_epoch == current_epoch-1` in this case
compute_historic_attester_duties(request_epoch, request_indices, chain)
}
}
Expand Down

0 comments on commit 5b0fa81

Please sign in to comment.