mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
srml-module: Phragmen election (#3364)
* phragmen election module. * Add new files. * Some doc update * Update weights. * bump and a few nits. * Performance improvement. * Master.into() * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Fix build * Some fixes. * Fix build. * Proper outgoing and runner-up managment. * Bit more sensical weight values. * Update srml/elections-phragmen/src/lib.rs * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * fix lock file * Fix build. * Remove runner-ups * Some refactors. * Add support for reporting voters. * Fix member check. * Remove equlize.rs * Update srml/elections-phragmen/src/lib.rs * Update srml/elections-phragmen/src/lib.rs * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Bring back runner ups. * use decode_len * Better weight values. * Update bogus doc * Bump. * Update srml/elections-phragmen/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io> * Review comments. * One more test * Fix tests * Fix build * .. and fix benchmarks. * Update srml/elections-phragmen/src/lib.rs * Version bump
This commit is contained in:
@@ -659,6 +659,16 @@ pub trait ChangeMembers<AccountId: Clone + Ord> {
|
||||
/// Set the new members; they **must already be sorted**. This will compute the diff and use it to
|
||||
/// call `change_members_sorted`.
|
||||
fn set_members_sorted(new_members: &[AccountId], old_members: &[AccountId]) {
|
||||
let (incoming, outgoing) = Self::compute_members_diff(new_members, old_members);
|
||||
Self::change_members_sorted(&incoming[..], &outgoing[..], &new_members);
|
||||
}
|
||||
|
||||
/// Set the new members; they **must already be sorted**. This will compute the diff and use it to
|
||||
/// call `change_members_sorted`.
|
||||
fn compute_members_diff(
|
||||
new_members: &[AccountId],
|
||||
old_members: &[AccountId]
|
||||
) -> (Vec<AccountId>, Vec<AccountId>) {
|
||||
let mut old_iter = old_members.iter();
|
||||
let mut new_iter = new_members.iter();
|
||||
let mut incoming = Vec::new();
|
||||
@@ -686,8 +696,7 @@ pub trait ChangeMembers<AccountId: Clone + Ord> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Self::change_members_sorted(&incoming[..], &outgoing[..], &new_members);
|
||||
(incoming, outgoing)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user