mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Implement the majority of per-epoch processing
This commit is contained in:
9
beacon_node/beacon_chain/src/epoch_processing.rs
Normal file
9
beacon_node/beacon_chain/src/epoch_processing.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use super::{BeaconChain, ClientDB, DBError, SlotClock};
|
||||
|
||||
impl<T, U> BeaconChain<T, U>
|
||||
where
|
||||
T: ClientDB,
|
||||
U: SlotClock,
|
||||
{
|
||||
pub fn per_epoch_processing(&self) {}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ pub mod block_processing;
|
||||
pub mod block_production;
|
||||
mod canonical_head;
|
||||
pub mod dump;
|
||||
pub mod epoch_processing;
|
||||
mod finalized_head;
|
||||
mod info;
|
||||
mod lmd_ghost;
|
||||
|
||||
@@ -239,12 +239,13 @@ where
|
||||
}
|
||||
ensure!(
|
||||
attestation.data.justified_block_root
|
||||
== *get_block_root(
|
||||
&state,
|
||||
attestation.data.justified_slot,
|
||||
self.spec.latest_block_roots_length
|
||||
)
|
||||
.ok_or(Error::NoBlockRoot)?,
|
||||
== *state
|
||||
.get_block_root(
|
||||
&state,
|
||||
attestation.data.justified_slot,
|
||||
self.spec.latest_block_roots_length
|
||||
)
|
||||
.ok_or(Error::NoBlockRoot)?,
|
||||
Error::BadAttestation
|
||||
);
|
||||
ensure!(
|
||||
@@ -376,24 +377,10 @@ fn get_attestation_participants(
|
||||
_attestation_data: &AttestationData,
|
||||
_aggregation_bitfield: &BooleanBitfield,
|
||||
) -> Vec<usize> {
|
||||
// TODO: stubbed out.
|
||||
vec![0, 1]
|
||||
}
|
||||
|
||||
fn get_block_root(
|
||||
state: &BeaconState,
|
||||
slot: u64,
|
||||
latest_block_roots_length: u64,
|
||||
) -> Option<&Hash256> {
|
||||
// TODO: test
|
||||
if state.slot <= slot + latest_block_roots_length && slot <= state.slot {
|
||||
state
|
||||
.latest_block_roots
|
||||
.get((slot % latest_block_roots_length) as usize)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn penalize_validator(_state: &BeaconState, _proposer_index: usize) {
|
||||
// TODO: stubbed out.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user