Function sc_consensus_pow::start_mining_worker [−][src]
pub fn start_mining_worker<Block, C, S, Algorithm, E, SO, L, CIDP, CAW>(
block_import: BoxBlockImport<Block, TransactionFor<C, 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,
can_author_with: CAW
) -> (Arc<Mutex<MiningWorker<Block, Algorithm, C, L, <E::Proposer as Proposer<Block>>::Proof>>>, impl Future<Output = ()>) where
Block: BlockT,
C: ProvideRuntimeApi<Block> + 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, Transaction = TransactionFor<C, Block>>,
SO: SyncOracle + Clone + Send + Sync + 'static,
L: JustificationSyncLink<Block>,
CIDP: CreateInherentDataProviders<Block, ()>,
CAW: CanAuthorWith<Block> + Clone + Send + 'static,
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.