Function sc_consensus_pow::start_mining_worker
source · pub fn start_mining_worker<Block, C, S, Algorithm, E, SO, L, CIDP>(
block_import: BoxBlockImport<Block>,
client: Arc<C>,
select_chain: S,
algorithm: Algorithm,
env: E,
sync_oracle: SO,
justification_sync_link: L,
pre_runtime: Option<Vec<u8>>,
create_inherent_data_providers: CIDP,
timeout: Duration,
build_time: Duration,
) -> (MiningHandle<Block, Algorithm, L, <E::Proposer as Proposer<Block>>::Proof>, impl Future<Output = ()>)where
Block: BlockT,
C: BlockchainEvents<Block> + 'static,
S: SelectChain<Block> + 'static,
Algorithm: PowAlgorithm<Block> + Clone,
Algorithm::Difficulty: Send + 'static,
E: Environment<Block> + Send + Sync + 'static,
E::Error: Debug,
E::Proposer: Proposer<Block>,
SO: SyncOracle + Clone + Send + Sync + 'static,
L: JustificationSyncLink<Block>,
CIDP: CreateInherentDataProviders<Block, ()>,
Expand description
Start the mining worker for PoW. This function provides the necessary helper functions that can be used to implement a miner. However, it does not do the CPU-intensive mining itself.
Two values are returned – a worker, which contains functions that allows querying the current mining metadata and submitting mined blocks, and a future, which must be polled to fill in information in the worker.
pre_runtime
is a parameter that allows a custom additional pre-runtime digest to be inserted
for blocks being built. This can encode authorship information, or just be a graffiti.