mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-31 16:31:20 +00:00
Fix clippy lints, small typos
This commit is contained in:
parent
c49f425fe8
commit
ab10cbbdb5
@ -495,12 +495,7 @@ where
|
|||||||
// TODO: this is a first-in-best-dressed scenario that is not ideal; fork_choice should be
|
// TODO: this is a first-in-best-dressed scenario that is not ideal; fork_choice should be
|
||||||
// run instead.
|
// run instead.
|
||||||
if self.head().beacon_block_root == parent_block_root {
|
if self.head().beacon_block_root == parent_block_root {
|
||||||
self.update_canonical_head(
|
self.update_canonical_head(block.clone(), block_root, state.clone(), state_root);
|
||||||
block.clone(),
|
|
||||||
block_root.clone(),
|
|
||||||
state.clone(),
|
|
||||||
state_root,
|
|
||||||
);
|
|
||||||
// Update the local state variable.
|
// Update the local state variable.
|
||||||
*self.state.write() = state.clone();
|
*self.state.write() = state.clone();
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,6 @@ fn winning_root(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: `cargo fmt` makes this rather ugly; tidy up.
|
|
||||||
let attesting_validator_indices = attestations
|
let attesting_validator_indices = attestations
|
||||||
.iter()
|
.iter()
|
||||||
.try_fold::<_, _, Result<_, BeaconStateError>>(vec![], |mut acc, a| {
|
.try_fold::<_, _, Result<_, BeaconStateError>>(vec![], |mut acc, a| {
|
||||||
|
@ -222,10 +222,10 @@ impl BeaconState {
|
|||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let cache_index = self.cache_index(relative_epoch);
|
let cache_index = self.cache_index(relative_epoch);
|
||||||
|
|
||||||
if self.caches[cache_index].initialized == false {
|
if self.caches[cache_index].initialized {
|
||||||
self.force_build_epoch_cache(relative_epoch, spec)
|
|
||||||
} else {
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
} else {
|
||||||
|
self.force_build_epoch_cache(relative_epoch, spec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,13 +297,13 @@ impl BeaconState {
|
|||||||
|
|
||||||
/// Returns the cache for some `RelativeEpoch`. Returns an error if the cache has not been
|
/// Returns the cache for some `RelativeEpoch`. Returns an error if the cache has not been
|
||||||
/// initialized.
|
/// initialized.
|
||||||
fn cache<'a>(&'a self, relative_epoch: RelativeEpoch) -> Result<&'a EpochCache, Error> {
|
fn cache(&self, relative_epoch: RelativeEpoch) -> Result<&EpochCache, Error> {
|
||||||
let cache = &self.caches[self.cache_index(relative_epoch)];
|
let cache = &self.caches[self.cache_index(relative_epoch)];
|
||||||
|
|
||||||
if cache.initialized == false {
|
if cache.initialized {
|
||||||
Err(Error::EpochCacheUninitialized(relative_epoch))
|
|
||||||
} else {
|
|
||||||
Ok(cache)
|
Ok(cache)
|
||||||
|
} else {
|
||||||
|
Err(Error::EpochCacheUninitialized(relative_epoch))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ impl BeaconState {
|
|||||||
let next_epoch = self.next_epoch(spec);
|
let next_epoch = self.next_epoch(spec);
|
||||||
|
|
||||||
if epoch == current_epoch {
|
if epoch == current_epoch {
|
||||||
trace!("get_crosslink_committees_at_slot: current_epoch");
|
trace!("get_committee_params_at_slot: current_epoch");
|
||||||
Ok((
|
Ok((
|
||||||
self.get_current_epoch_committee_count(spec),
|
self.get_current_epoch_committee_count(spec),
|
||||||
self.current_epoch_seed,
|
self.current_epoch_seed,
|
||||||
@ -556,7 +556,7 @@ impl BeaconState {
|
|||||||
self.current_epoch_start_shard,
|
self.current_epoch_start_shard,
|
||||||
))
|
))
|
||||||
} else if epoch == previous_epoch {
|
} else if epoch == previous_epoch {
|
||||||
trace!("get_crosslink_committees_at_slot: previous_epoch");
|
trace!("get_committee_params_at_slot: previous_epoch");
|
||||||
Ok((
|
Ok((
|
||||||
self.get_previous_epoch_committee_count(spec),
|
self.get_previous_epoch_committee_count(spec),
|
||||||
self.previous_epoch_seed,
|
self.previous_epoch_seed,
|
||||||
@ -564,7 +564,7 @@ impl BeaconState {
|
|||||||
self.previous_epoch_start_shard,
|
self.previous_epoch_start_shard,
|
||||||
))
|
))
|
||||||
} else if epoch == next_epoch {
|
} else if epoch == next_epoch {
|
||||||
trace!("get_crosslink_committees_at_slot: next_epoch");
|
trace!("get_committee_params_at_slot: next_epoch");
|
||||||
let current_committees_per_epoch = self.get_current_epoch_committee_count(spec);
|
let current_committees_per_epoch = self.get_current_epoch_committee_count(spec);
|
||||||
let epochs_since_last_registry_update =
|
let epochs_since_last_registry_update =
|
||||||
current_epoch - self.validator_registry_update_epoch;
|
current_epoch - self.validator_registry_update_epoch;
|
||||||
|
Loading…
Reference in New Issue
Block a user