Skip to content

Commit

Permalink
fix bug, replace wet code with DRY composition
Browse files Browse the repository at this point in the history
  • Loading branch information
zancas committed Mar 31, 2024
1 parent 65cb364 commit 3493715
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zingo-status/src/confirmation_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ impl ConfirmationStatus {
/// ```
pub fn is_confirmed_before_or_at(&self, comparison_height: &BlockHeight) -> bool {
match self {
Self::Confirmed(self_height) => self_height <= comparison_height,
Self::Confirmed(self_height) => {
self.is_confirmed_before(comparison_height) || self_height == comparison_height
}
_ => false,
}
}
Expand All @@ -117,7 +119,7 @@ impl ConfirmationStatus {
/// ```
pub fn is_confirmed_before(&self, comparison_height: &BlockHeight) -> bool {
match self {
Self::Confirmed(self_height) => self_height <= comparison_height,
Self::Confirmed(self_height) => self_height < comparison_height,
_ => false,
}
}
Expand Down

0 comments on commit 3493715

Please sign in to comment.