Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Correct 'PartialOrd' implementation for 'PruneCandidate'
Browse files Browse the repository at this point in the history
The previous implementation used 'Ordering::reverse' incorrectly, potentially leading to incorrect element ordering. The corrected code now properly returns the result of 'self.cmp(other)', aligning with the 'PartialOrd' trait's requirements for element comparisons.

Signed-off-by: Joseph Livesey <[email protected]>
  • Loading branch information
suchapalaver committed Nov 1, 2023
1 parent 5454770 commit 24714b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validator/src/state/state_pruning_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Ord for PruneCandidate {

impl PartialOrd for PruneCandidate {
fn partial_cmp(&self, other: &PruneCandidate) -> Option<Ordering> {
Some(Ordering::reverse(self.0.cmp(&other.0)))
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit 24714b7

Please sign in to comment.