Add block reward contract config to ethash and allow off-chain contracts (#9312)

This adds block reward contract config to ethash. A new config `blockRewardContractCode` is also added to both Aura and ethash. When specified, it will execute the code directly and overrides any `blockRewardContractAddress` config. Having this `blockRewardContractCode` config allows chains to deploy hard fork by simply replacing the current config value, without the need from us to support any `multi` block reward scheme.
This commit is contained in:
Wei Tang
2018-08-29 23:17:18 +08:00
committed by André Silva
parent 1073d56245
commit 74ce0f738e
8 changed files with 261 additions and 116 deletions

View File

@@ -89,7 +89,7 @@ impl<M: WithBalances + WithRewards> Engine<M> for NullEngine<M>
for u in LiveBlock::uncles(&*block) {
let uncle_author = u.author();
let result_uncle_reward = (reward * U256::from(8 + u.number() - number)).shr(3);
rewards.push((*uncle_author, RewardKind::Uncle, result_uncle_reward));
rewards.push((*uncle_author, RewardKind::uncle(number, u.number()), result_uncle_reward));
}
block_reward::apply_block_rewards(&rewards, block, &self.machine)