mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 13:25:44 +00:00
Fixes #3826. The docs on the `candidates` field of `BlockEntry` were incorrectly stating that they are sorted by core index. The (incorrect) optimization was introduced in #3747 based on this assumption. The actual ordering is based on `CandidateIncluded` events ordering in the runtime. We revert this optimization here. - [x] verify the underlying issue - [x] add a regression test --------- Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -1285,10 +1285,10 @@ fn cores_to_candidate_indices(
|
||||
|
||||
// Map from core index to candidate index.
|
||||
for claimed_core_index in core_indices.iter_ones() {
|
||||
// Candidates are sorted by core index.
|
||||
if let Ok(candidate_index) = block_entry
|
||||
if let Some(candidate_index) = block_entry
|
||||
.candidates()
|
||||
.binary_search_by_key(&(claimed_core_index as u32), |(core_index, _)| core_index.0)
|
||||
.iter()
|
||||
.position(|(core_index, _)| core_index.0 == claimed_core_index as u32)
|
||||
{
|
||||
candidate_indices.push(candidate_index as _);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user