Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Advance AuRa step as far as we can and prevent invalid blocks. (#7451)
Browse files Browse the repository at this point in the history
* Advance AuRa step as far as we can.

* Wait for future blocks.
  • Loading branch information
tomusdrw committed Jan 8, 2018
1 parent 1350462 commit 51c9a59
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,10 @@ impl Step {
}

fn check_future(&self, given: usize) -> Result<(), Option<OutOfBounds<u64>>> {
const VALID_STEP_DRIFT: usize = 1;
const REJECTED_STEP_DRIFT: usize = 4;

// Give one step slack if step is lagging, double vote is still not possible.
if given <= self.load() + VALID_STEP_DRIFT {
// Verify if the step is correct.
if given <= self.load() {
return Ok(());
}

Expand All @@ -148,11 +147,11 @@ impl Step {
if given > current + REJECTED_STEP_DRIFT {
Err(None)
// wait a bit for blocks in near future
} else if given > current + VALID_STEP_DRIFT {
} else if given > current {
let d = self.duration as u64;
Err(Some(OutOfBounds {
min: None,
max: Some(d * (current + VALID_STEP_DRIFT) as u64),
max: Some(d * current as u64),
found: d * given as u64,
}))
} else {
Expand Down

0 comments on commit 51c9a59

Please sign in to comment.