[−][src]Function sc_consensus_pow::start_mine
pub fn start_mine<B: BlockT, C, Algorithm, E, SO, S, CAW>(
block_import: BoxBlockImport<B, TransactionFor<C, B>>,
client: Arc<C>,
algorithm: Algorithm,
env: E,
preruntime: Option<Vec<u8>>,
round: u32,
sync_oracle: SO,
build_time: Duration,
select_chain: Option<S>,
inherent_data_providers: InherentDataProviders,
can_author_with: CAW
) where
C: HeaderBackend<B> + AuxStore + ProvideRuntimeApi<B> + 'static,
Algorithm: PowAlgorithm<B> + Send + Sync + 'static,
E: Environment<B> + Send + Sync + 'static,
E::Error: Debug,
E::Proposer: Proposer<B, Transaction = TransactionFor<C, B>>,
SO: SyncOracle + Send + Sync + 'static,
S: SelectChain<B> + 'static,
CAW: CanAuthorWith<B> + Send + 'static,
Start the background mining thread for PoW. Note that because PoW mining is CPU-intensive, it is not possible to use an async future to define this. However, it's not recommended to use background threads in the rest of the codebase.
preruntime
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. round
is for number of rounds the
CPU miner runs each time. This parameter should be tweaked so that each
mining round is within sub-second time.