diff --git a/data_structures/src/staking/stakes.rs b/data_structures/src/staking/stakes.rs index 1f850b1eb..f7fba9fb5 100644 --- a/data_structures/src/staking/stakes.rs +++ b/data_structures/src/staking/stakes.rs @@ -206,7 +206,7 @@ where capability: Capability, epoch: Epoch, strategy: CensusStrategy, - ) -> Box> + '_> { + ) -> Box + '_> { let iterator = self.rank(capability, epoch).map(|(address, _)| address); match strategy { @@ -256,13 +256,17 @@ where &self, capability: Capability, current_epoch: Epoch, - ) -> impl Iterator, Power)> + '_ { - self.by_coins + ) -> impl Iterator + '_ { + self.by_validator .iter() - .map(move |(CoinsAndAddresses { addresses, .. }, stake)| { - let power = stake.read_value().power(capability, current_epoch); - - (addresses.clone(), power) + .map(move |(address, stakes)| { + let power = stakes + .first() + .unwrap() + .read_value() + .power(capability, current_epoch); + + (address.clone(), power) }) .sorted_by_key(|(_, power)| *power) .rev() diff --git a/node/src/actors/chain_manager/handlers.rs b/node/src/actors/chain_manager/handlers.rs index 45efd60b3..b1425a3bb 100644 --- a/node/src/actors/chain_manager/handlers.rs +++ b/node/src/actors/chain_manager/handlers.rs @@ -201,13 +201,13 @@ impl Handler> for ChainManager { .rank(Capability::Mining, previous_epoch) .take(replication_factor.into()) .collect(); - for (i, (stake_key, _)) in rank_subset.into_iter().enumerate() { + for (i, (validator, _)) in rank_subset.into_iter().enumerate() { log::warn!( "Slashed the power of {} as it did not propose a block", - stake_key.validator + validator ); let _ = stakes.reset_age( - stake_key.validator, + validator, Capability::Mining, msg.checkpoint, // This should never fail