Skip to content

Commit

Permalink
cargo fmt --all -- --config imports_granularity=Crate
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Nov 9, 2023
1 parent 2e560b3 commit bd6f70f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions crates/ethcore/src/engines/hbbft/hbbft_message_memorium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,26 @@ impl NodeStakingEpochHistory {

/// protocols a good seal event.
pub fn add_seal_event_late(&mut self, event: &SealEventLate) {

// by definition a "good sealing" is always on the latest block.
let block_num = event.block_num;

if block_num < self.last_late_sealing_message {
warn!(target: "hbbft_message_memorium", "out of order seal events: add_late_seal_event: event.block_num {block_num} <= self.last_late_sealing_message {}", self.last_late_sealing_message);
return;
}

// add cumulative lateness, for all blocks between the last tracked block
// and the current block.
if self.last_late_sealing_message > 0 && self.last_late_sealing_message < event.block_num - 1 {
if self.last_late_sealing_message > 0
&& self.last_late_sealing_message < event.block_num - 1
{
let difference = event.block_num - 1 - self.last_late_sealing_message;
self.cumulative_lateness += (difference * (difference + 1)) / 2;
}

self.last_late_sealing_message = event.block_num;
self.cumulative_lateness += event.get_lateness();
self.sealing_blocks_late.push(event.block_num);


}

pub(crate) fn add_bad_seal_event(&mut self, event: &SealEventBad) {
Expand Down Expand Up @@ -1157,8 +1156,4 @@ impl PrometheusMetrics for HbbftMessageMemorium {
}

#[cfg(test)]
mod tests {



}
mod tests {}

0 comments on commit bd6f70f

Please sign in to comment.