From 926fa4c5f4858f9955bbeb3c77f73f386d697032 Mon Sep 17 00:00:00 2001 From: zhangsoledad <787953403@qq.com> Date: Fri, 16 Jun 2023 11:15:24 +0800 Subject: [PATCH] fix: permanent difficulty mode reward --- spec/src/consensus.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/src/consensus.rs b/spec/src/consensus.rs index a7d053610c..800225209c 100644 --- a/spec/src/consensus.rs +++ b/spec/src/consensus.rs @@ -797,9 +797,18 @@ impl Consensus { epoch_duration_in_milliseconds, } => { if self.permanent_difficulty() { + let primary_epoch_reward = + self.primary_epoch_reward_of_next_epoch(&epoch).as_u64(); + let block_reward = + Capacity::shannons(primary_epoch_reward / epoch.length()); + let remainder_reward = + Capacity::shannons(primary_epoch_reward % epoch.length()); + let dummy_epoch_ext = epoch .clone() .into_builder() + .base_block_reward(block_reward) + .remainder_reward(remainder_reward) .number(epoch.number() + 1) .last_block_hash_in_previous_epoch(header.hash()) .start_number(header.number() + 1)