Skip to content

Commit

Permalink
Consensus: neat epoch_length calculation.
Browse files Browse the repository at this point in the history
Co-authored-by: Quake Wang <[email protected]>
  • Loading branch information
eval-exec and quake authored Aug 11, 2023
1 parent 84d4bf9 commit 27e69ae
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions spec/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,12 +804,7 @@ impl Consensus {
let remainder_reward =
Capacity::shannons(primary_epoch_reward % epoch.length());

let mut next_epoch_length = epoch.length();
let epoch_length_from_param =
cmp::max(self.epoch_duration_target() / MIN_BLOCK_INTERVAL, 1);
if next_epoch_length != epoch_length_from_param {
next_epoch_length = self.epoch_duration_target() / MIN_BLOCK_INTERVAL;
}
let next_epoch_length = (self.epoch_duration_target() + MIN_BLOCK_INTERVAL - 1) / MIN_BLOCK_INTERVAL

let dummy_epoch_ext = epoch
.clone()
Expand Down

0 comments on commit 27e69ae

Please sign in to comment.