Cleanup our sort usage (#6754)

This commit is contained in:
Gavin Wood
2020-07-29 14:00:51 +02:00
committed by GitHub
parent 1ab7719314
commit 6bfbb7c6f1
12 changed files with 16 additions and 16 deletions
+3 -3
View File
@@ -1238,12 +1238,12 @@ decl_storage! {
decl_event!(
pub enum Event<T> where Balance = BalanceOf<T>, <T as frame_system::Trait>::AccountId {
/// The era payout has been set; the first balance is the validator-payout; the second is
/// the remainder from the maximum amount of reward.
/// the remainder from the maximum amount of reward.
/// [era_index, validator_payout, remainder]
EraPayout(EraIndex, Balance, Balance),
/// The staker has been rewarded by this amount. [stash, amount]
Reward(AccountId, Balance),
/// One validator (and its nominators) has been slashed by the given amount.
/// One validator (and its nominators) has been slashed by the given amount.
/// [validator, amount]
Slash(AccountId, Balance),
/// An old slashing report from a prior era was discarded because it could
@@ -2889,7 +2889,7 @@ impl<T: Trait> Module<T> {
let mut exposure_clipped = exposure;
let clipped_max_len = T::MaxNominatorRewardedPerValidator::get() as usize;
if exposure_clipped.others.len() > clipped_max_len {
exposure_clipped.others.sort_unstable_by(|a, b| a.value.cmp(&b.value).reverse());
exposure_clipped.others.sort_by(|a, b| a.value.cmp(&b.value).reverse());
exposure_clipped.others.truncate(clipped_max_len);
}
<ErasStakersClipped<T>>::insert(&current_era, &stash, exposure_clipped);