Skip to content

Commit d07b58a

Browse files
authored
Merge pull request #4227 from zhangsoledad/zhangsoledad/fix-dummy-block-reward
fix: dummy block reward
2 parents 1bebc3d + ce66490 commit d07b58a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

spec/src/consensus.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -824,16 +824,15 @@ impl Consensus {
824824
epoch_duration_in_milliseconds,
825825
} => {
826826
if self.permanent_difficulty() {
827+
let next_epoch_length = (self.epoch_duration_target() + MIN_BLOCK_INTERVAL
828+
- 1)
829+
/ MIN_BLOCK_INTERVAL;
827830
let primary_epoch_reward =
828831
self.primary_epoch_reward_of_next_epoch(&epoch).as_u64();
829832
let block_reward =
830-
Capacity::shannons(primary_epoch_reward / epoch.length());
833+
Capacity::shannons(primary_epoch_reward / next_epoch_length);
831834
let remainder_reward =
832-
Capacity::shannons(primary_epoch_reward % epoch.length());
833-
834-
let next_epoch_length = (self.epoch_duration_target() + MIN_BLOCK_INTERVAL
835-
- 1)
836-
/ MIN_BLOCK_INTERVAL;
835+
Capacity::shannons(primary_epoch_reward % next_epoch_length);
837836

838837
let dummy_epoch_ext = epoch
839838
.clone()

0 commit comments

Comments
 (0)