zebrad::components::miner

Function mine_a_block

source
pub async fn mine_a_block<F>(
    solver_id: u8,
    template: Arc<Block>,
    cancel_fn: F,
) -> Result<AtLeastOne<Block>, SolverCancelled>
where F: FnMut() -> Result<(), SolverCancelled> + Send + Sync + 'static,
Expand description

Mines one or more blocks based on template. Calculates equihash solutions, checks difficulty, and returns as soon as it has at least one block. Uses a different nonce range for each solver_id.

If cancel_fn() returns an error, returns early with Err(SolverCancelled).

See run_mining_solver() for more details.