From a3078fe3981b8d018fe67dd2e7289f4cf28bbec1 Mon Sep 17 00:00:00 2001 From: Alberto Sonnino Date: Thu, 19 May 2022 18:11:47 -0400 Subject: [PATCH] Implement Ord for consensus indices (#263) Fix comments --- narwhal/executor/src/state.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/narwhal/executor/src/state.rs b/narwhal/executor/src/state.rs index 2e7c7a6fb81a0..e931d8b5238e5 100644 --- a/narwhal/executor/src/state.rs +++ b/narwhal/executor/src/state.rs @@ -65,17 +65,16 @@ impl ExecutionIndices { impl Ord for ExecutionIndices { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - if self.next_certificate_index == other.next_certificate_index { - if self.next_batch_index == other.next_batch_index { - self.next_transaction_index - .cmp(&other.next_transaction_index) - } else { - self.next_batch_index.cmp(&other.next_batch_index) - } - } else { - self.next_certificate_index - .cmp(&other.next_certificate_index) - } + ( + self.next_certificate_index, + self.next_batch_index, + self.next_transaction_index, + ) + .cmp(&( + other.next_certificate_index, + other.next_batch_index, + other.next_transaction_index, + )) } }