[][src]Struct beacon_chain::ForkChoice

pub struct ForkChoice<T: BeaconChainTypes> { /* fields omitted */ }

Methods

impl<T: BeaconChainTypes> ForkChoice<T>[src]

pub fn new(
    store: Arc<T::Store>,
    backend: T::LmdGhost,
    genesis_block_root: Hash256
) -> Self
[src]

Instantiate a new fork chooser.

"Genesis" does not necessarily need to be the absolute genesis, it can be some finalized block.

pub fn find_head(&self, chain: &BeaconChain<T>) -> Result<Hash256, Error>[src]

pub fn process_block(
    &self,
    state: &BeaconState<T::EthSpec>,
    block: &BeaconBlock<T::EthSpec>,
    block_root: Hash256
) -> Result<(), Error>
[src]

Process all attestations in the given block.

Assumes the block (and therefore it's attestations) are valid. It is a logic error to provide an invalid block.

pub fn process_attestation(
    &self,
    state: &BeaconState<T::EthSpec>,
    attestation: &Attestation<T::EthSpec>,
    block: &BeaconBlock<T::EthSpec>
) -> Result<(), Error>
[src]

Process an attestation which references block in attestation.data.beacon_block_root.

Assumes the attestation is valid.

pub fn latest_message(&self, validator_index: usize) -> Option<(Hash256, Slot)>[src]

Returns the latest message for a given validator, if any.

Returns (block_root, block_slot).

pub fn verify_integrity(&self) -> Result<(), String>[src]

Runs an integrity verification function on the underlying fork choice algorithm.

Returns Ok(()) if the underlying fork choice has maintained it's integrity, Err(description) otherwise.

pub fn process_finalization(
    &self,
    finalized_block: &BeaconBlock<T::EthSpec>,
    finalized_block_root: Hash256
) -> Result<(), Error>
[src]

Inform the fork choice that the given block (and corresponding root) have been finalized so it may prune it's storage.

finalized_block_root must be the root of finalized_block.

Auto Trait Implementations

impl<T> Send for ForkChoice<T> where
    <T as BeaconChainTypes>::LmdGhost: Send,
    <T as BeaconChainTypes>::Store: Send + Sync

impl<T> Unpin for ForkChoice<T> where
    <T as BeaconChainTypes>::LmdGhost: Unpin

impl<T> Sync for ForkChoice<T> where
    <T as BeaconChainTypes>::LmdGhost: Sync,
    <T as BeaconChainTypes>::Store: Send + Sync

impl<T> UnwindSafe for ForkChoice<T> where
    <T as BeaconChainTypes>::LmdGhost: UnwindSafe,
    <T as BeaconChainTypes>::Store: RefUnwindSafe

impl<T> RefUnwindSafe for ForkChoice<T> where
    <T as BeaconChainTypes>::LmdGhost: RefUnwindSafe,
    <T as BeaconChainTypes>::Store: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Erased for T