Replaces stable sort with unstable sort (#30223)
This commit is contained in:
parent
128ffbdf9b
commit
d27c860249
|
@ -5007,8 +5007,10 @@ impl Bank {
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
assert!(!validator_stakes.is_empty());
|
assert!(!validator_stakes.is_empty());
|
||||||
|
|
||||||
// Sort first by stake and then by validator identity pubkey for determinism
|
// Sort first by stake and then by validator identity pubkey for determinism.
|
||||||
validator_stakes.sort_by(|(pubkey1, staked1), (pubkey2, staked2)| {
|
// If two items are still equal, their relative order does not matter since
|
||||||
|
// both refer to the same validator.
|
||||||
|
validator_stakes.sort_unstable_by(|(pubkey1, staked1), (pubkey2, staked2)| {
|
||||||
staked2.cmp(staked1).then(pubkey2.cmp(pubkey1))
|
staked2.cmp(staked1).then(pubkey2.cmp(pubkey1))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue