Trait tc_consensus_slots::SlotWorker[][src]

pub trait SlotWorker<B: BlockT> {
    type OnSlot: Future<Output = Option<SlotResult<B>>>;
    fn on_slot(
        &mut self,
        chain_head: B::Header,
        slot_info: SlotInfo
    ) -> Self::OnSlot; }

A worker that should be invoked at every new slot.

The implementation should not make any assumptions of the slot being bound to the time or similar. The only valid assumption is that the slot number is always increasing.

Associated Types

type OnSlot: Future<Output = Option<SlotResult<B>>>[src]

The type of the future that will be returned when a new slot is triggered.

Loading content...

Required methods

fn on_slot(
    &mut self,
    chain_head: B::Header,
    slot_info: SlotInfo
) -> Self::OnSlot
[src]

Called when a new slot is triggered.

Returns a future that resolves to a SlotResult iff a block was successfully built in the slot. Otherwise None is returned.

Loading content...

Implementors

impl<B: BlockT, T: SimpleSlotWorker<B>> SlotWorker<B> for T[src]

type OnSlot = Pin<Box<dyn Future<Output = Option<SlotResult<B>>> + Send>>

Loading content...