mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Most remove ffg_update_required
This commit is contained in:
@@ -103,7 +103,6 @@ impl ProtoArrayForkChoice {
|
|||||||
) -> Result<Self, String> {
|
) -> Result<Self, String> {
|
||||||
let mut proto_array = ProtoArray {
|
let mut proto_array = ProtoArray {
|
||||||
prune_threshold: DEFAULT_PRUNE_THRESHOLD,
|
prune_threshold: DEFAULT_PRUNE_THRESHOLD,
|
||||||
ffg_update_required: false,
|
|
||||||
justified_epoch,
|
justified_epoch,
|
||||||
finalized_epoch,
|
finalized_epoch,
|
||||||
nodes: Vec::with_capacity(1),
|
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
|
/// Do not attempt to prune the tree unless it has at least this many nodes. Small prunes
|
||||||
/// simply waste time.
|
/// simply waste time.
|
||||||
pub prune_threshold: usize,
|
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 justified_epoch: Epoch,
|
||||||
pub finalized_epoch: Epoch,
|
pub finalized_epoch: Epoch,
|
||||||
pub nodes: Vec<ProtoNode>,
|
pub nodes: Vec<ProtoNode>,
|
||||||
@@ -59,13 +56,7 @@ impl ProtoArray {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `self.ffg_update_required` flag indicates if it is necessary to check the
|
if justified_epoch != self.justified_epoch || finalized_epoch != self.finalized_epoch {
|
||||||
// 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 {
|
|
||||||
self.justified_epoch = justified_epoch;
|
self.justified_epoch = justified_epoch;
|
||||||
self.finalized_epoch = finalized_epoch;
|
self.finalized_epoch = finalized_epoch;
|
||||||
}
|
}
|
||||||
@@ -124,8 +115,6 @@ impl ProtoArray {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.ffg_update_required = false;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +224,6 @@ impl ProtoArray {
|
|||||||
});
|
});
|
||||||
} else if finalized_epoch != self.finalized_epoch {
|
} else if finalized_epoch != self.finalized_epoch {
|
||||||
self.finalized_epoch = finalized_epoch;
|
self.finalized_epoch = finalized_epoch;
|
||||||
self.ffg_update_required = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let finalized_index = *self
|
let finalized_index = *self
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ 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,
|
ffg_update_required: bool,
|
||||||
justified_epoch: Epoch,
|
justified_epoch: Epoch,
|
||||||
finalized_epoch: Epoch,
|
finalized_epoch: Epoch,
|
||||||
@@ -28,7 +30,7 @@ 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: proto_array.ffg_update_required,
|
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(),
|
||||||
@@ -41,7 +43,6 @@ impl From<SszContainer> for ProtoArrayForkChoice {
|
|||||||
fn from(from: SszContainer) -> Self {
|
fn from(from: SszContainer) -> Self {
|
||||||
let proto_array = ProtoArray {
|
let proto_array = ProtoArray {
|
||||||
prune_threshold: from.prune_threshold,
|
prune_threshold: from.prune_threshold,
|
||||||
ffg_update_required: from.ffg_update_required,
|
|
||||||
justified_epoch: from.justified_epoch,
|
justified_epoch: from.justified_epoch,
|
||||||
finalized_epoch: from.finalized_epoch,
|
finalized_epoch: from.finalized_epoch,
|
||||||
nodes: from.nodes,
|
nodes: from.nodes,
|
||||||
|
|||||||
Reference in New Issue
Block a user