ECIP-1039: Monetary policy rounding specification

Fix potential rounding errors between geth and parity in the long-term future.
This commit is contained in:
Wei Tang 2017-11-16 12:25:05 +08:00 committed by GitHub
parent 605cd5cd9f
commit 2ca57d7cdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -450,7 +450,10 @@ fn ecip1017_eras_block_reward(era_rounds: u64, mut reward: U256, block_number:u6
block_number / era_rounds
};
for _ in 0..eras {
reward = reward / U256::from(5) * U256::from(4);
reward = reward * U256::from(4);
}
for _ in 0..eras {
reward = reward / U256::from(5);
}
(eras, reward)
}