mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Most remove ffg_update_required
This commit is contained in:
@@ -103,7 +103,6 @@ impl ProtoArrayForkChoice {
|
||||
) -> Result<Self, String> {
|
||||
let mut proto_array = ProtoArray {
|
||||
prune_threshold: DEFAULT_PRUNE_THRESHOLD,
|
||||
ffg_update_required: false,
|
||||
justified_epoch,
|
||||
finalized_epoch,
|
||||
nodes: Vec::with_capacity(1),
|
||||
|
||||
@@ -22,9 +22,6 @@ pub struct ProtoArray {
|
||||
/// Do not attempt to prune the tree unless it has at least this many nodes. Small prunes
|
||||
/// simply waste time.
|
||||
pub prune_threshold: usize,
|
||||
/// Set to true when the Casper FFG justified/finalized epochs should be checked to ensure the
|
||||
/// tree is filtered as per eth2 specs.
|
||||
pub ffg_update_required: bool,
|
||||
pub justified_epoch: Epoch,
|
||||
pub finalized_epoch: Epoch,
|
||||
pub nodes: Vec<ProtoNode>,
|
||||
@@ -59,13 +56,7 @@ impl ProtoArray {
|
||||
});
|
||||
}
|
||||
|
||||
// The `self.ffg_update_required` flag indicates if it is necessary to check the
|
||||
// finalized/justified epoch of all nodes against the epochs in `self`.
|
||||
//
|
||||
// This behaviour is equivalent to the `filter_block_tree` function in the spec.
|
||||
self.ffg_update_required =
|
||||
justified_epoch != self.justified_epoch || finalized_epoch != self.finalized_epoch;
|
||||
if self.ffg_update_required {
|
||||
if justified_epoch != self.justified_epoch || finalized_epoch != self.finalized_epoch {
|
||||
self.justified_epoch = justified_epoch;
|
||||
self.finalized_epoch = finalized_epoch;
|
||||
}
|
||||
@@ -124,8 +115,6 @@ impl ProtoArray {
|
||||
}
|
||||
}
|
||||
|
||||
self.ffg_update_required = false;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -235,7 +224,6 @@ impl ProtoArray {
|
||||
});
|
||||
} else if finalized_epoch != self.finalized_epoch {
|
||||
self.finalized_epoch = finalized_epoch;
|
||||
self.ffg_update_required = true;
|
||||
}
|
||||
|
||||
let finalized_index = *self
|
||||
|
||||
@@ -13,6 +13,8 @@ pub struct SszContainer {
|
||||
votes: Vec<VoteTracker>,
|
||||
balances: Vec<u64>,
|
||||
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,
|
||||
finalized_epoch: Epoch,
|
||||
@@ -28,7 +30,7 @@ impl From<&ProtoArrayForkChoice> for SszContainer {
|
||||
votes: from.votes.read().0.clone(),
|
||||
balances: from.balances.read().clone(),
|
||||
prune_threshold: proto_array.prune_threshold,
|
||||
ffg_update_required: proto_array.ffg_update_required,
|
||||
ffg_update_required: false,
|
||||
justified_epoch: proto_array.justified_epoch,
|
||||
finalized_epoch: proto_array.finalized_epoch,
|
||||
nodes: proto_array.nodes.clone(),
|
||||
@@ -41,7 +43,6 @@ impl From<SszContainer> for ProtoArrayForkChoice {
|
||||
fn from(from: SszContainer) -> Self {
|
||||
let proto_array = ProtoArray {
|
||||
prune_threshold: from.prune_threshold,
|
||||
ffg_update_required: from.ffg_update_required,
|
||||
justified_epoch: from.justified_epoch,
|
||||
finalized_epoch: from.finalized_epoch,
|
||||
nodes: from.nodes,
|
||||
|
||||
Reference in New Issue
Block a user