Change reward calculation to only use divide once

This commit is contained in:
Wei Tang 2017-11-16 12:34:04 +08:00 committed by GitHub
parent 2ca57d7cdb
commit b35cc3f716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}