mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
clean the interface of supports map (#9674)
* clean the interface of supports map, make it a bit cleaner and more efficients * Fix stiff * fix one test * Fix warnings
This commit is contained in:
@@ -81,14 +81,13 @@ impl<T: Config> ElectionProvider<T::AccountId, T::BlockNumber> for OnChainSequen
|
||||
let stake_of =
|
||||
|w: &T::AccountId| -> VoteWeight { stake_map.get(w).cloned().unwrap_or_default() };
|
||||
|
||||
let ElectionResult { winners, assignments } =
|
||||
let ElectionResult { winners: _, assignments } =
|
||||
seq_phragmen::<_, T::Accuracy>(desired_targets as usize, targets, voters, None)
|
||||
.map_err(Error::from)?;
|
||||
|
||||
let staked = assignment_ratio_to_staked_normalized(assignments, &stake_of)?;
|
||||
let winners = to_without_backing(winners);
|
||||
|
||||
to_supports(&winners, &staked).map_err(Error::from)
|
||||
Ok(to_supports(&staked))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user