Skip to content

Commit

Permalink
hyperspace: avoid calling height() multiple times unnecessary (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
blasrodri authored Oct 24, 2023
1 parent 8b64727 commit 1448ca5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hyperspace/metrics/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,17 @@ impl MetricsHandler {
IbcEvent::TimeoutOnClosePacket(_) |
IbcEvent::UpdateClient(_)
) {
let current_revision_height = event.height().revision_height;
// Skip events that are older than the latest event processed before this function
// was called, as it is an event that was processed in the past.
// Skip it
if latest_processed_height > event.height().revision_height {
if latest_processed_height > current_revision_height {
continue
}
// if an event contains a new revision height, we update the variable that
// denotes that we've processed a newer height
if new_latest_processed_height < event.height().revision_height {
new_latest_processed_height = event.height().revision_height;
if new_latest_processed_height < current_revision_height {
new_latest_processed_height = current_revision_height;
}
}
match event {
Expand Down

0 comments on commit 1448ca5

Please sign in to comment.