mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Implement iter for doublemap (#5504)
* implement iter for doublemap * fmt * fix tests * fix staking mock * address comment * update doc and constraint for reversible hasher Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -528,7 +528,7 @@ fn check_ledgers() {
|
||||
fn check_exposures() {
|
||||
// a check per validator to ensure the exposure struct is always sane.
|
||||
let era = active_era();
|
||||
ErasStakers::<Test>::iter_prefix(era).for_each(|expo| {
|
||||
ErasStakers::<Test>::iter_prefix_values(era).for_each(|expo| {
|
||||
assert_eq!(
|
||||
expo.total as u128,
|
||||
expo.own as u128 + expo.others.iter().map(|e| e.value as u128).sum::<u128>(),
|
||||
|
||||
@@ -340,7 +340,7 @@ fn less_than_needed_candidates_works() {
|
||||
// But the exposure is updated in a simple way. No external votes exists.
|
||||
// This is purely self-vote.
|
||||
assert!(
|
||||
ErasStakers::<Test>::iter_prefix(Staking::active_era().unwrap().index)
|
||||
ErasStakers::<Test>::iter_prefix_values(Staking::active_era().unwrap().index)
|
||||
.all(|exposure| exposure.others.is_empty())
|
||||
);
|
||||
});
|
||||
@@ -461,7 +461,7 @@ fn nominating_and_rewards_should_work() {
|
||||
// ------ check the staked value of all parties.
|
||||
|
||||
// 30 and 40 are not chosen anymore
|
||||
assert_eq!(ErasStakers::<Test>::iter_prefix(Staking::active_era().unwrap().index).count(), 2);
|
||||
assert_eq!(ErasStakers::<Test>::iter_prefix_values(Staking::active_era().unwrap().index).count(), 2);
|
||||
assert_eq!(
|
||||
Staking::eras_stakers(Staking::active_era().unwrap().index, 11),
|
||||
Exposure {
|
||||
|
||||
Reference in New Issue
Block a user