pub trait ServiceInterface<Block: BlockT> {
// Required methods
fn check_block_status(
&self,
hash: Block::Hash,
header: &Block::Header,
) -> bool;
fn build_collation(
&self,
parent_header: &Block::Header,
block_hash: Block::Hash,
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)>;
fn announce_with_barrier(
&self,
block_hash: Block::Hash,
) -> Sender<CollationSecondedSignal>;
fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>);
}
Expand description
Utility functions generally applicable to writing collators for Cumulus.
Required Methods§
sourcefn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool
fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool
Checks the status of the given block hash in the Parachain.
Returns true
if the block could be found and is good to be build on.
sourcefn build_collation(
&self,
parent_header: &Block::Header,
block_hash: Block::Hash,
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)>
fn build_collation( &self, parent_header: &Block::Header, block_hash: Block::Hash, candidate: ParachainCandidate<Block>, ) -> Option<(Collation, ParachainBlockData<Block>)>
Build a full Collation
from a given [ParachainCandidate
]. This requires
that the underlying block has been fully imported into the underlying client,
as implementations will fetch underlying runtime API data.
This also returns the unencoded parachain block data, in case that is desired.
sourcefn announce_with_barrier(
&self,
block_hash: Block::Hash,
) -> Sender<CollationSecondedSignal>
fn announce_with_barrier( &self, block_hash: Block::Hash, ) -> Sender<CollationSecondedSignal>
Inform networking systems that the block should be announced after a signal has been received to indicate the block has been seconded by a relay-chain validator.
This sets up the barrier and returns the sending side of a channel, for the signal to be passed through.