Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit d27c860

Browse files
authored
Replaces stable sort with unstable sort (#30223)
1 parent 128ffbd commit d27c860

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

runtime/src/bank.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5007,8 +5007,10 @@ impl Bank {
50075007
#[cfg(not(test))]
50085008
assert!(!validator_stakes.is_empty());
50095009

5010-
// Sort first by stake and then by validator identity pubkey for determinism
5011-
validator_stakes.sort_by(|(pubkey1, staked1), (pubkey2, staked2)| {
5010+
// Sort first by stake and then by validator identity pubkey for determinism.
5011+
// If two items are still equal, their relative order does not matter since
5012+
// both refer to the same validator.
5013+
validator_stakes.sort_unstable_by(|(pubkey1, staked1), (pubkey2, staked2)| {
50125014
staked2.cmp(staked1).then(pubkey2.cmp(pubkey1))
50135015
});
50145016

0 commit comments

Comments
 (0)