Trait sc_consensus_slots::SlotWorker
source · pub trait SlotWorker<B: BlockT, Proof> {
// Required method
fn on_slot<'life0, 'async_trait>(
&'life0 mut self,
slot_info: SlotInfo<B>,
) -> Pin<Box<dyn Future<Output = Option<SlotResult<B, Proof>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
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.
Required Methods§
sourcefn on_slot<'life0, 'async_trait>(
&'life0 mut self,
slot_info: SlotInfo<B>,
) -> Pin<Box<dyn Future<Output = Option<SlotResult<B, Proof>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_slot<'life0, 'async_trait>(
&'life0 mut self,
slot_info: SlotInfo<B>,
) -> Pin<Box<dyn Future<Output = Option<SlotResult<B, Proof>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.