Use parent blockhash to seed EpochRewardsHasher (#34744)
* Use parent blockhash to seed rewards-partition hasher * Make blockhash word more consistent
This commit is contained in:
parent
904700cc56
commit
8e2943604b
|
@ -2355,9 +2355,13 @@ impl Bank {
|
|||
.unwrap_or_default();
|
||||
|
||||
let num_partitions = self.get_reward_distribution_num_blocks(&stake_rewards.stake_rewards);
|
||||
let parent_blockhash = self
|
||||
.parent()
|
||||
.expect("Partitioned rewards calculation must still have access to parent Bank.")
|
||||
.last_blockhash();
|
||||
let stake_rewards_by_partition = hash_rewards_into_partitions(
|
||||
std::mem::take(&mut stake_rewards.stake_rewards),
|
||||
&self.parent_hash(),
|
||||
&parent_blockhash,
|
||||
num_partitions as usize,
|
||||
);
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ fn hash_to_partition(hash: u64, partitions: usize) -> usize {
|
|||
|
||||
pub(crate) fn hash_rewards_into_partitions(
|
||||
stake_rewards: StakeRewards,
|
||||
parent_block_hash: &Hash,
|
||||
parent_blockhash: &Hash,
|
||||
num_partitions: usize,
|
||||
) -> Vec<StakeRewards> {
|
||||
let hasher = EpochRewardsHasher::new(num_partitions, parent_block_hash);
|
||||
let hasher = EpochRewardsHasher::new(num_partitions, parent_blockhash);
|
||||
let mut result = vec![vec![]; num_partitions];
|
||||
|
||||
for reward in stake_rewards {
|
||||
|
|
Loading…
Reference in New Issue