From b35cc3f7168d03b7c22bf462b774ee1fa3e5fc8d Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 16 Nov 2017 12:34:04 +0800 Subject: [PATCH] Change reward calculation to only use divide once --- ethcore/src/ethereum/ethash.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 8beafd3d7..c28fc2050 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -449,12 +449,12 @@ fn ecip1017_eras_block_reward(era_rounds: u64, mut reward: U256, block_number:u6 } else { block_number / era_rounds }; + let mut divi = U256::from(1); for _ in 0..eras { reward = reward * U256::from(4); + divi = divi * U256::from(5); } - for _ in 0..eras { - reward = reward / U256::from(5); - } + reward = reward / divi; (eras, reward) }