Fix Reduce Equalise order in offhchain phragmen (#5892)

This commit is contained in:
Kian Paimani
2020-05-05 13:50:42 +02:00
committed by GitHub
parent 1f7f8abb33
commit 16af2642ff
5 changed files with 44 additions and 31 deletions
+3
View File
@@ -2338,6 +2338,9 @@ impl<T: Trait> Module<T> {
// candidates.
let snapshot_length = <SnapshotValidators<T>>::decode_len()
.map_err(|_| Error::<T>::SnapshotUnavailable)?;
// check the winner length only here and when we know the length of the snapshot validators
// length.
let desired_winners = Self::validator_count().min(snapshot_length as u32);
ensure!(winners.len() as u32 == desired_winners, Error::<T>::PhragmenBogusWinnerCount);