Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
elliedavidson committed Oct 12, 2023
1 parent 689f959 commit 6fd0f40
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions crates/task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,33 +793,32 @@ where
}
// Create a positive vote if either liveness or safety check
// passes.
else {
// Liveness check.
let liveness_check = justify_qc.view_number > consensus.locked_view;

// Safety check.
// Check if proposal extends from the locked leaf.
let outcome = consensus.visit_leaf_ancestors(
justify_qc.view_number,
Terminator::Inclusive(consensus.locked_view),
false,
|leaf| {
// if leaf view no == locked view no then we're done, report success by
// returning true
leaf.view_number != consensus.locked_view
},
);
let safety_check = outcome.is_ok();
if let Err(e) = outcome {
self.api.send_view_error(view, Arc::new(e)).await;
return;
}

// Skip if both saftey and liveness checks fail.
if !safety_check && !liveness_check {
error!("Failed safety check and liveness check");
return;
}
// Liveness check.
let liveness_check = justify_qc.view_number > consensus.locked_view;

// Safety check.
// Check if proposal extends from the locked leaf.
let outcome = consensus.visit_leaf_ancestors(
justify_qc.view_number,
Terminator::Inclusive(consensus.locked_view),
false,
|leaf| {
// if leaf view no == locked view no then we're done, report success by
// returning true
leaf.view_number != consensus.locked_view
},
);
let safety_check = outcome.is_ok();
if let Err(e) = outcome {
self.api.send_view_error(view, Arc::new(e)).await;
return;
}

// Skip if both saftey and liveness checks fail.
if !safety_check && !liveness_check {
error!("Failed safety check and liveness check");
return;
}

let high_qc = leaf.justify_qc.clone();
Expand Down

0 comments on commit 6fd0f40

Please sign in to comment.