[][src]Struct operation_pool::OperationPool

pub struct OperationPool<T: EthSpec + Default> { /* fields omitted */ }

Methods

impl<T: EthSpec> OperationPool<T>[src]

pub fn new() -> Self[src]

Create a new operation pool.

pub fn insert_attestation(
    &self,
    attestation: Attestation<T>,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Result<(), AttestationValidationError>
[src]

Insert an attestation into the pool, aggregating it with existing attestations if possible.

Note

This function assumes the given attestation is valid.

pub fn num_attestations(&self) -> usize[src]

Total number of attestations in the pool, including attestations for the same data.

pub fn get_attestations(
    &self,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Vec<Attestation<T>>
[src]

Get a list of attestations for inclusion in a block.

pub fn prune_attestations(&self, finalized_state: &BeaconState<T>)[src]

Remove attestations which are too old to be included in a block.

pub fn insert_deposit(
    &self,
    index: u64,
    deposit: Deposit
) -> Result<DepositInsertStatus, DepositValidationError>
[src]

Add a deposit to the pool.

No two distinct deposits should be added with the same index.

pub fn get_deposits(&self, state: &BeaconState<T>) -> Vec<Deposit>[src]

Get an ordered list of deposits for inclusion in a block.

Take at most the maximum number of deposits, beginning from the current deposit index.

pub fn prune_deposits(&self, state: &BeaconState<T>) -> BTreeMap<u64, Deposit>[src]

Remove all deposits with index less than the deposit index of the latest finalised block.

pub fn num_deposits(&self) -> usize[src]

The number of deposits stored in the pool.

pub fn insert_proposer_slashing(
    &self,
    slashing: ProposerSlashing,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Result<(), ProposerSlashingValidationError>
[src]

Insert a proposer slashing into the pool.

pub fn insert_attester_slashing(
    &self,
    slashing: AttesterSlashing<T>,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Result<(), AttesterSlashingValidationError>
[src]

Insert an attester slashing into the pool.

pub fn get_slashings(
    &self,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> (Vec<ProposerSlashing>, Vec<AttesterSlashing<T>>)
[src]

Get proposer and attester slashings for inclusion in a block.

This function computes both types of slashings together, because attester slashings may be invalidated by proposer slashings included earlier in the block.

pub fn prune_proposer_slashings(&self, finalized_state: &BeaconState<T>)[src]

Prune proposer slashings for all slashed or withdrawn validators.

pub fn prune_attester_slashings(
    &self,
    finalized_state: &BeaconState<T>,
    spec: &ChainSpec
)
[src]

Prune attester slashings for all slashed or withdrawn validators, or attestations on another fork.

pub fn insert_voluntary_exit(
    &self,
    exit: VoluntaryExit,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Result<(), ExitValidationError>
[src]

Insert a voluntary exit, validating it almost-entirely (future exits are permitted).

pub fn get_voluntary_exits(
    &self,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Vec<VoluntaryExit>
[src]

Get a list of voluntary exits for inclusion in a block.

pub fn prune_voluntary_exits(&self, finalized_state: &BeaconState<T>)[src]

Prune if validator has already exited at the last finalized state.

pub fn insert_transfer(
    &self,
    transfer: Transfer,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Result<(), TransferValidationError>
[src]

Insert a transfer into the pool, checking it for validity in the process.

pub fn get_transfers(
    &self,
    state: &BeaconState<T>,
    spec: &ChainSpec
) -> Vec<Transfer>
[src]

Get a list of transfers for inclusion in a block.

pub fn prune_transfers(&self, finalized_state: &BeaconState<T>)[src]

Prune the set of transfers by removing all those whose slot has already passed.

pub fn prune_all(&self, finalized_state: &BeaconState<T>, spec: &ChainSpec)[src]

Prune all types of transactions given the latest finalized state.

Trait Implementations

impl<T: Default + EthSpec> Default for OperationPool<T>[src]

impl<T: EthSpec + Default> PartialEq<OperationPool<T>> for OperationPool<T>[src]

Compare two operation pools.

impl<T: Debug + EthSpec + Default> Debug for OperationPool<T>[src]

Auto Trait Implementations

impl<T> Send for OperationPool<T> where
    <T as EthSpec>::MaxValidatorsPerCommittee: Send

impl<T> Unpin for OperationPool<T> where
    T: Unpin,
    <T as EthSpec>::MaxValidatorsPerCommittee: Unpin

impl<T> Sync for OperationPool<T> where
    <T as EthSpec>::MaxValidatorsPerCommittee: Send + Sync

impl<T> UnwindSafe for OperationPool<T> where
    T: UnwindSafe,
    <T as EthSpec>::MaxValidatorsPerCommittee: UnwindSafe

impl<T> !RefUnwindSafe for OperationPool<T>

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>,