Skip to content
Permalink
Browse files

Update the Epoch assertion

we keep on assert in the task as we still need to manage the special
case where the task is a bit behind schedule.
  • Loading branch information...
NicolasDP committed May 14, 2019
1 parent c967f4f commit 464e30449b3ed9199a63d936e569e03a699b50be
Showing with 1 addition and 15 deletions.
  1. +0 −13 src/leadership/process.rs
  2. +1 −2 src/leadership/task.rs
@@ -198,19 +198,6 @@ fn handle_epoch(
let era = task_parameters.leadership.era().clone();
let time_frame = task_parameters.time_frame.clone();

let current_slot = time_frame.slot_at(&std::time::SystemTime::now()).expect(
"assume we cannot only get one valid timeline and that the slot duration does not change",
);
let epoch_position = era
.from_slot_to_era(current_slot)
.expect("assume the current time is already in the era");

// TODO: need to handle:
//
// * if too early for the leadership, we need to wait
// * if too late for this leadership, log it and return
assert!(epoch_position.epoch.0 == task_parameters.epoch);

let last_slot_in_epoch = era.slots_per_epoch() - 1;

let slot = era.from_era_to_slot(EpochPosition {
@@ -127,9 +127,8 @@ fn handle_leadership(

// TODO: need to handle:
//
// * if too early for the leadership, we need to wait
// * if too late for this leadership, log it and return
assert!(epoch_position.epoch.0 == task_parameters.epoch);
assert!(epoch_position.epoch.0 <= task_parameters.epoch);

let schedule = LeaderSchedule::new(logger.clone(), leader, &task_parameters);

0 comments on commit 464e304

Please sign in to comment.
You can’t perform that action at this time.