Function block_reward
pub const fn block_reward(base_block_reward: u128, ommers: usize) -> u128
Expand description
Calculates the reward for a block, including the reward for ommer inclusion.
The base reward should be calculated using base_block_reward
. ommers
represents the number
of ommers included in the block.
§Examples
// This is block 126 on mainnet.
let block_number = 126;
let number_of_ommers = 1;
let reward = base_block_reward(&*MAINNET, block_number).map(|reward| block_reward(reward, 1));
// The base block reward is 5 ETH, and the ommer inclusion reward is 1/32th of 5 ETH.
assert_eq!(reward.unwrap(), ETH_TO_WEI * 5 + ((ETH_TO_WEI * 5) >> 5));
§References
- Definition: Yellow Paper (page 15, 11.3)