mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-28 14:57:17 +00:00
Implement fixes from PR review
This commit is contained in:
parent
3a196f3fdc
commit
8afe8b3569
@ -87,7 +87,7 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
start_state
|
||||
.validator_registry
|
||||
.get(validator_index)
|
||||
.and_then(|v| Some(v.effective_balance))
|
||||
.map(|v| v.effective_balance)
|
||||
};
|
||||
|
||||
self.backend
|
||||
|
@ -33,7 +33,7 @@ fn fork() {
|
||||
let honest_fork_blocks = delay + 1;
|
||||
let faulty_fork_blocks = delay + 2;
|
||||
|
||||
// Build an initial chain were all validators agree.
|
||||
// Build an initial chain where all validators agree.
|
||||
harness.extend_chain(
|
||||
initial_blocks,
|
||||
BlockStrategy::OnCanonicalHead,
|
||||
|
@ -586,13 +586,10 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
|
||||
/// Gets the oldest (earliest slot) state root.
|
||||
///
|
||||
/// Spec v0.5.1
|
||||
/// Spec v0.6.3
|
||||
pub fn get_oldest_state_root(&self) -> Result<&Hash256, Error> {
|
||||
let lookback = std::cmp::min(
|
||||
self.slot - Slot::from(self.latest_state_roots.len()),
|
||||
self.slot,
|
||||
);
|
||||
let i = self.get_latest_state_roots_index(self.slot - lookback)?;
|
||||
let i = self
|
||||
.get_latest_state_roots_index(self.slot - Slot::from(self.latest_state_roots.len()))?;
|
||||
Ok(&self.latest_state_roots[i])
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user