mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Tidy latest_message
This commit is contained in:
@@ -73,6 +73,7 @@ impl From<VoteTracker> for VoteTrackerV28 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Spec's `LatestMessage` type. Only used in tests.
|
||||||
pub struct LatestMessage {
|
pub struct LatestMessage {
|
||||||
pub slot: Slot,
|
pub slot: Slot,
|
||||||
pub root: Hash256,
|
pub root: Hash256,
|
||||||
@@ -1064,10 +1065,9 @@ impl ProtoArrayForkChoice {
|
|||||||
.is_finalized_checkpoint_or_descendant::<E>(descendant_root, best_finalized_checkpoint)
|
.is_finalized_checkpoint_or_descendant::<E>(descendant_root, best_finalized_checkpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// NOTE: only used in tests.
|
||||||
pub fn latest_message(&self, validator_index: usize) -> Option<LatestMessage> {
|
pub fn latest_message(&self, validator_index: usize) -> Option<LatestMessage> {
|
||||||
if validator_index < self.votes.0.len() {
|
if let Some(vote) = self.votes.0.get(validator_index) {
|
||||||
let vote = &self.votes.0[validator_index];
|
|
||||||
|
|
||||||
if *vote == VoteTracker::default() {
|
if *vote == VoteTracker::default() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user