From ce66490a30b86338a3e19a672d6eb62ddc9538dd Mon Sep 17 00:00:00 2001 From: zhangsoledad <787953403@qq.com> Date: Fri, 10 Nov 2023 12:01:59 +0800 Subject: [PATCH] fix: dummy block reward --- spec/src/consensus.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/src/consensus.rs b/spec/src/consensus.rs index 1627c483f6..ede01dd5c0 100644 --- a/spec/src/consensus.rs +++ b/spec/src/consensus.rs @@ -824,16 +824,15 @@ impl Consensus { epoch_duration_in_milliseconds, } => { if self.permanent_difficulty() { + let next_epoch_length = (self.epoch_duration_target() + MIN_BLOCK_INTERVAL + - 1) + / MIN_BLOCK_INTERVAL; let primary_epoch_reward = self.primary_epoch_reward_of_next_epoch(&epoch).as_u64(); let block_reward = - Capacity::shannons(primary_epoch_reward / epoch.length()); + Capacity::shannons(primary_epoch_reward / next_epoch_length); let remainder_reward = - Capacity::shannons(primary_epoch_reward % epoch.length()); - - let next_epoch_length = (self.epoch_duration_target() + MIN_BLOCK_INTERVAL - - 1) - / MIN_BLOCK_INTERVAL; + Capacity::shannons(primary_epoch_reward % next_epoch_length); let dummy_epoch_ext = epoch .clone()