pub trait ParachainConsensus<B: BlockT>: Send + Sync + DynClone {
// Required method
fn produce_candidate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
parent: &'life1 B::Header,
relay_parent: PHash,
validation_data: &'life2 PersistedValidationData,
) -> Pin<Box<dyn Future<Output = Option<ParachainCandidate<B>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
A specific parachain consensus implementation that can be used by a collator to produce candidates.
The collator will call Self::produce_candidate
every time there is a free core for the
parachain this collator is collating for. It is the job of the consensus implementation to
decide if this specific collator should build a candidate for the given relay chain block. The
consensus implementation could, for example, check whether this specific collator is part of a
staked set.
Required Methods§
sourcefn produce_candidate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
parent: &'life1 B::Header,
relay_parent: PHash,
validation_data: &'life2 PersistedValidationData,
) -> Pin<Box<dyn Future<Output = Option<ParachainCandidate<B>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn produce_candidate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
parent: &'life1 B::Header,
relay_parent: PHash,
validation_data: &'life2 PersistedValidationData,
) -> Pin<Box<dyn Future<Output = Option<ParachainCandidate<B>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Produce a new candidate at the given parent block and relay-parent blocks.
Should return None
if the consensus implementation decided that it shouldn’t build a
candidate or if there occurred any error.
§NOTE
It is expected that the block is already imported when the future resolves.