Function sc_consensus_pow::start_mining_worker[][src]

pub fn start_mining_worker<Block, C, S, Algorithm, E, SO, CAW>(
    block_import: BoxBlockImport<Block, TransactionFor<C, Block>>,
    client: Arc<C>,
    select_chain: S,
    algorithm: Algorithm,
    mut env: E,
    mut sync_oracle: SO,
    pre_runtime: Option<Vec<u8>>,
    inherent_data_providers: InherentDataProviders,
    timeout: Duration,
    build_time: Duration,
    can_author_with: CAW
) -> (Arc<Mutex<MiningWorker<Block, Algorithm, C>>>, impl Future<Output = ()>) where
    Block: BlockT,
    C: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + 'static,
    S: SelectChain<Block> + 'static,
    Algorithm: PowAlgorithm<Block> + Clone,
    Algorithm::Difficulty: 'static,
    E: Environment<Block> + Send + Sync + 'static,
    E::Error: Debug,
    E::Proposer: Proposer<Block, Transaction = TransactionFor<C, Block>>,
    SO: SyncOracle + Clone + Send + Sync + 'static,
    CAW: CanAuthorWith<Block> + Clone + Send + 'static, 

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.