Skip to content

Commit 7910f12

Browse files
committed
PR Review: Add block_hash to ChainPoint ord & fix typo
1 parent f97c4c1 commit 7910f12

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

mithril-common/src/entities/cardano_chain_point.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl Ord for ChainPoint {
6868
self.block_number
6969
.cmp(&other.block_number)
7070
.then(self.slot_number.cmp(&other.slot_number))
71+
.then(self.block_hash.cmp(&other.block_hash))
7172
}
7273
}
7374

@@ -160,7 +161,7 @@ mod tests {
160161
}
161162

162163
#[test]
163-
fn chain_point_ord_cmp_block_hash_doesnt_matter() {
164+
fn chain_point_ord_cmp_if_block_number_and_slot_number_equals_then_compare_block_hash() {
164165
let chain_point1 = ChainPoint {
165166
slot_number: 5,
166167
block_number: 10,
@@ -172,6 +173,6 @@ mod tests {
172173
block_hash: "hash2".to_string(),
173174
};
174175

175-
assert_eq!(Ordering::Equal, chain_point1.cmp(&chain_point2));
176+
assert_eq!(Ordering::Less, chain_point1.cmp(&chain_point2));
176177
}
177178
}

mithril-common/src/time_point_provider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ where
2020
/// [TimePointProvider] related errors.
2121
#[derive(Error, Debug)]
2222
pub enum TimePointProviderError {
23-
/// Raised reading the current epoch succeeded but yield no result.
24-
#[error("No epoch yield by the chain observer, is your cardano node ready ?")]
23+
/// Raised when reading the current epoch succeeded but yielded no result.
24+
#[error("No epoch yielded by the chain observer, is your cardano node ready?")]
2525
NoEpoch,
2626

27-
/// Raised reading the current chain point succeeded but yield no result.
28-
#[error("No chain point yield by the chain observer, is your cardano node ready ?")]
27+
/// Raised when reading the current chain point succeeded but yielded no result.
28+
#[error("No chain point yielded by the chain observer, is your cardano node ready?")]
2929
NoChainPoint,
3030
}
3131

0 commit comments

Comments
 (0)