Skip to content

Commit

Permalink
A better hack around epoch issue in get_crosslink_committees_at_slot
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalinin committed Mar 7, 2019
1 parent faf4cf3 commit d679550
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ public List<ShardCommittee> get_crosslink_committees_at_slot(
int committees_per_epoch;
EpochNumber shuffling_epoch;
ShardNumber shuffling_start_shard;
if (epoch.equals(currentEpoch)) {
// 'lookahead' might already happened if
// get_crosslink_committees_at_slot is called after epoch transition
// hacking around
if ((epoch.equals(currentEpoch) && currentEpoch.greaterEqual(state.getCurrentShufflingEpoch()))
|| (epoch.equals(nextEpoch) && nextEpoch.equals(state.getCurrentShufflingEpoch()))) {
/*
if epoch == current_epoch:
committees_per_epoch = get_current_epoch_committee_count(state)
Expand All @@ -215,7 +219,8 @@ public List<ShardCommittee> get_crosslink_committees_at_slot(
seed = state.getCurrentShufflingSeed();
shuffling_epoch = state.getCurrentShufflingEpoch();
shuffling_start_shard = state.getCurrentShufflingStartShard();
} else if (epoch.equals(previousEpoch)) {
} else if (epoch.equals(previousEpoch) ||
(epoch.equals(currentEpoch) && currentEpoch.less(state.getCurrentShufflingEpoch()))) {
/*
elif epoch == previous_epoch:
committees_per_epoch = get_previous_epoch_committee_count(state)
Expand Down

0 comments on commit d679550

Please sign in to comment.