Skip to content

Commit

Permalink
Implement Ord for consensus indices (MystenLabs#263)
Browse files Browse the repository at this point in the history
Fix comments
  • Loading branch information
asonnino authored May 19, 2022
1 parent 9c1a1e0 commit a3078fe
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions narwhal/executor/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))
}
}

Expand Down

0 comments on commit a3078fe

Please sign in to comment.