Trait sc_consensus_slots::SimpleSlotWorker [−][src]
A skeleton implementation for SlotWorker
which tries to claim a slot at
its beginning and tries to produce a block if successfully claimed, timing
out if block production takes too long.
Associated Types
type BlockImport: BlockImport<B, Transaction = <Self::Proposer as Proposer<B>>::Transaction> + Send + 'static
[src]
A handle to a BlockImport
.
type SyncOracle: SyncOracle
[src]
A handle to a SyncOracle
.
type CreateProposer: Future<Output = Result<Self::Proposer, Error>> + Send + Unpin + 'static
[src]
The type of future resolving to the proposer.
type Proposer: Proposer<B>
[src]
The type of proposer to use to build blocks.
type Claim: Send + 'static
[src]
Data associated with a slot claim.
type EpochData: Send + 'static
[src]
Epoch data necessary for authoring.
Required methods
fn logging_target(&self) -> &'static str
[src]
The logging target to use when logging messages.
fn block_import(&self) -> Arc<Mutex<Self::BlockImport>>
[src]
A handle to a BlockImport
.
fn epoch_data(
&self,
header: &B::Header,
slot_number: u64
) -> Result<Self::EpochData, Error>
[src]
&self,
header: &B::Header,
slot_number: u64
) -> Result<Self::EpochData, Error>
Returns the epoch data necessary for authoring. For time-dependent epochs, use the provided slot number as a canonical source of time.
fn authorities_len(&self, epoch_data: &Self::EpochData) -> Option<usize>
[src]
Returns the number of authorities given the epoch data. None indicate that the authorities information is incomplete.
fn claim_slot(
&self,
header: &B::Header,
slot_number: u64,
epoch_data: &Self::EpochData
) -> Option<Self::Claim>
[src]
&self,
header: &B::Header,
slot_number: u64,
epoch_data: &Self::EpochData
) -> Option<Self::Claim>
Tries to claim the given slot, returning an object with claim data if successful.
fn pre_digest_data(
&self,
slot_number: u64,
claim: &Self::Claim
) -> Vec<DigestItem<B::Hash>>
[src]
&self,
slot_number: u64,
claim: &Self::Claim
) -> Vec<DigestItem<B::Hash>>
Return the pre digest data to include in a block authored with the given claim.
fn block_import_params(
&self
) -> Box<dyn Fn(B::Header, &B::Hash, Vec<B::Extrinsic>, StorageChanges<<Self::BlockImport as BlockImport<B>>::Transaction, B>, Self::Claim, Self::EpochData) -> Result<BlockImportParams<B, <Self::BlockImport as BlockImport<B>>::Transaction>, Error> + Send + 'static>
[src]
&self
) -> Box<dyn Fn(B::Header, &B::Hash, Vec<B::Extrinsic>, StorageChanges<<Self::BlockImport as BlockImport<B>>::Transaction, B>, Self::Claim, Self::EpochData) -> Result<BlockImportParams<B, <Self::BlockImport as BlockImport<B>>::Transaction>, Error> + Send + 'static>
Returns a function which produces a BlockImportParams
.
fn force_authoring(&self) -> bool
[src]
Whether to force authoring if offline.
fn sync_oracle(&mut self) -> &mut Self::SyncOracle
[src]
Returns a handle to a SyncOracle
.
fn proposer(&mut self, block: &B::Header) -> Self::CreateProposer
[src]
Returns a Proposer
to author on top of the given block.
Provided methods
fn notify_slot(
&self,
_header: &B::Header,
_slot_number: u64,
_epoch_data: &Self::EpochData
)
[src]
&self,
_header: &B::Header,
_slot_number: u64,
_epoch_data: &Self::EpochData
)
Notifies the given slot. Similar to claim_slot
, but will be called no matter whether we
need to author blocks or not.
fn slot_remaining_duration(&self, slot_info: &SlotInfo) -> Duration
[src]
Remaining duration of the slot.
fn proposing_remaining_duration(
&self,
_head: &B::Header,
slot_info: &SlotInfo
) -> Option<Duration>
[src]
&self,
_head: &B::Header,
slot_info: &SlotInfo
) -> Option<Duration>
Remaining duration for proposing. None means unlimited.
fn on_slot(
&mut self,
chain_head: B::Header,
slot_info: SlotInfo
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> where
Self: Send + Sync,
<Self::Proposer as Proposer<B>>::Proposal: Unpin + Send + 'static,
[src]
&mut self,
chain_head: B::Header,
slot_info: SlotInfo
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> where
Self: Send + Sync,
<Self::Proposer as Proposer<B>>::Proposal: Unpin + Send + 'static,
Implements the on_slot
functionality from SlotWorker
.