mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
General tidy
This commit is contained in:
@@ -61,7 +61,7 @@ pub enum BlockProcessingOutcome {
|
|||||||
/// The parent block was unknown.
|
/// The parent block was unknown.
|
||||||
ParentUnknown {
|
ParentUnknown {
|
||||||
parent: Hash256,
|
parent: Hash256,
|
||||||
reference_location: String,
|
reference_location: &'static str,
|
||||||
},
|
},
|
||||||
/// The block slot is greater than the present slot.
|
/// The block slot is greater than the present slot.
|
||||||
FutureSlot {
|
FutureSlot {
|
||||||
@@ -1239,7 +1239,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
if !self.fork_choice.contains_block(&block.parent_root) {
|
if !self.fork_choice.contains_block(&block.parent_root) {
|
||||||
return Ok(BlockProcessingOutcome::ParentUnknown {
|
return Ok(BlockProcessingOutcome::ParentUnknown {
|
||||||
parent: block.parent_root,
|
parent: block.parent_root,
|
||||||
reference_location: "fork_choice".to_string(),
|
reference_location: "fork_choice",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,7 +1280,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
None => {
|
None => {
|
||||||
return Ok(BlockProcessingOutcome::ParentUnknown {
|
return Ok(BlockProcessingOutcome::ParentUnknown {
|
||||||
parent: block.parent_root,
|
parent: block.parent_root,
|
||||||
reference_location: "database".to_string(),
|
reference_location: "database",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use std::fs::File;
|
|||||||
fn main() {
|
fn main() {
|
||||||
write_test_def_to_yaml("votes.yaml", get_votes_test_definition());
|
write_test_def_to_yaml("votes.yaml", get_votes_test_definition());
|
||||||
write_test_def_to_yaml("no_votes.yaml", get_no_votes_test_definition());
|
write_test_def_to_yaml("no_votes.yaml", get_no_votes_test_definition());
|
||||||
write_test_def_to_yaml("no_votes.yaml", get_ffg_case_01_test_definition());
|
write_test_def_to_yaml("ffg_01.yaml", get_ffg_case_01_test_definition());
|
||||||
write_test_def_to_yaml("no_votes.yaml", get_ffg_case_02_test_definition());
|
write_test_def_to_yaml("ffg_02.yaml", get_ffg_case_02_test_definition());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_test_def_to_yaml(filename: &str, def: ForkChoiceTestDefinition) {
|
fn write_test_def_to_yaml(filename: &str, def: ForkChoiceTestDefinition) {
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ impl ProtoArray {
|
|||||||
/// - Back-propgrate each nodes delta to its parents delta.
|
/// - Back-propgrate each nodes delta to its parents delta.
|
||||||
/// - Compare the current node with the parents best-child, updating it if the current node
|
/// - Compare the current node with the parents best-child, updating it if the current node
|
||||||
/// should become the best child.
|
/// should become the best child.
|
||||||
/// - Update the parents best-descendant with the current node or its best-descendant, if
|
/// - If required, update the parents best-descendant with the current node or its best-descendant.
|
||||||
/// required.
|
|
||||||
pub fn apply_score_changes(
|
pub fn apply_score_changes(
|
||||||
&mut self,
|
&mut self,
|
||||||
mut deltas: Vec<i64>,
|
mut deltas: Vec<i64>,
|
||||||
@@ -187,8 +186,7 @@ impl ProtoArray {
|
|||||||
.get(best_descendant_index)
|
.get(best_descendant_index)
|
||||||
.ok_or_else(|| Error::InvalidBestDescendant(best_descendant_index))?;
|
.ok_or_else(|| Error::InvalidBestDescendant(best_descendant_index))?;
|
||||||
|
|
||||||
// It is a logic error to try and find the head starting from a block that does not match
|
// Perform a sanity check that the node is indeed valid to be the head.
|
||||||
// the filter.
|
|
||||||
if !self.node_is_viable_for_head(&best_node) {
|
if !self.node_is_viable_for_head(&best_node) {
|
||||||
return Err(Error::InvalidBestNode {
|
return Err(Error::InvalidBestNode {
|
||||||
start_root: *justified_root,
|
start_root: *justified_root,
|
||||||
@@ -329,7 +327,6 @@ impl ProtoArray {
|
|||||||
.get(best_child_index)
|
.get(best_child_index)
|
||||||
.ok_or_else(|| Error::InvalidBestDescendant(best_child_index))?;
|
.ok_or_else(|| Error::InvalidBestDescendant(best_child_index))?;
|
||||||
|
|
||||||
let child_leads_to_viable_head = self.node_leads_to_viable_head(&child)?;
|
|
||||||
let best_child_leads_to_viable_head =
|
let best_child_leads_to_viable_head =
|
||||||
self.node_leads_to_viable_head(&best_child)?;
|
self.node_leads_to_viable_head(&best_child)?;
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ pub struct SszContainer {
|
|||||||
votes: Vec<VoteTracker>,
|
votes: Vec<VoteTracker>,
|
||||||
balances: Vec<u64>,
|
balances: Vec<u64>,
|
||||||
prune_threshold: usize,
|
prune_threshold: usize,
|
||||||
// TODO: this field is no longer required, I'm just leaving it here for the time being so we
|
|
||||||
// don't need to resync nodes.
|
|
||||||
ffg_update_required: bool,
|
|
||||||
justified_epoch: Epoch,
|
justified_epoch: Epoch,
|
||||||
finalized_epoch: Epoch,
|
finalized_epoch: Epoch,
|
||||||
nodes: Vec<ProtoNode>,
|
nodes: Vec<ProtoNode>,
|
||||||
@@ -30,7 +27,6 @@ impl From<&ProtoArrayForkChoice> for SszContainer {
|
|||||||
votes: from.votes.read().0.clone(),
|
votes: from.votes.read().0.clone(),
|
||||||
balances: from.balances.read().clone(),
|
balances: from.balances.read().clone(),
|
||||||
prune_threshold: proto_array.prune_threshold,
|
prune_threshold: proto_array.prune_threshold,
|
||||||
ffg_update_required: false,
|
|
||||||
justified_epoch: proto_array.justified_epoch,
|
justified_epoch: proto_array.justified_epoch,
|
||||||
finalized_epoch: proto_array.finalized_epoch,
|
finalized_epoch: proto_array.finalized_epoch,
|
||||||
nodes: proto_array.nodes.clone(),
|
nodes: proto_array.nodes.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user