Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAK CHANGE! Consensus: epoch_duration_target now affects epoch length in Dummy mode #4097

Merged
merged 8 commits into from
Aug 17, 2023
8 changes: 8 additions & 0 deletions spec/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,13 @@ 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;
}
eval-exec marked this conversation as resolved.
Show resolved Hide resolved

let dummy_epoch_ext = epoch
.clone()
.into_builder()
Expand All @@ -812,6 +819,7 @@ impl Consensus {
.number(epoch.number() + 1)
.last_block_hash_in_previous_epoch(header.hash())
.start_number(header.number() + 1)
.length(next_epoch_length)
.build();
NextBlockEpoch::HeadBlock(dummy_epoch_ext)
} else {
Expand Down
Loading