Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ impl<T: BeaconChainTypes> ChainCollection<T> {
.iter()
.map(|(id, chain)| (chain.available_peers(), !chain.is_syncing(), *id))
.collect::<Vec<_>>();
preferred_ids.sort_unstable();
// Sort in descending order
preferred_ids.sort_unstable_by(|a, b| b.cmp(a));
Copy link
Member

@michaelsproul michaelsproul Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm satisfied that this works for the !chain.is_syncing() part too, as the not-syncing chains will have true, which sorts higher than false (syncing).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree. Based on the comment, I think the intention was always to construct preferred_ids such that the descending sort works, but we sorted ascending by mistake.


let mut syncing_chains = SmallVec::<[Id; PARALLEL_HEAD_CHAINS]>::new();
for (_, _, id) in preferred_ids {
Expand Down