From 24714b77522d432da69c4501172fb6513a1a084f Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Thu, 12 Oct 2023 10:35:31 -0400 Subject: [PATCH] Correct 'PartialOrd' implementation for 'PruneCandidate' 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 --- validator/src/state/state_pruning_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/state/state_pruning_manager.rs b/validator/src/state/state_pruning_manager.rs index 161deea97f..7ddb767516 100644 --- a/validator/src/state/state_pruning_manager.rs +++ b/validator/src/state/state_pruning_manager.rs @@ -49,7 +49,7 @@ impl Ord for PruneCandidate { impl PartialOrd for PruneCandidate { fn partial_cmp(&self, other: &PruneCandidate) -> Option { - Some(Ordering::reverse(self.0.cmp(&other.0))) + Some(self.cmp(other)) } }