zebrad::components::miner

Function run_mining_solver

source
pub async fn run_mining_solver<Mempool, State, Tip, BlockVerifierRouter, SyncStatus, AddressBook>(
    solver_id: u8,
    template_receiver: WatchReceiver<Option<Arc<Block>>>,
    rpc: GetBlockTemplateRpcImpl<Mempool, State, Tip, BlockVerifierRouter, SyncStatus, AddressBook>,
) -> Result<(), Report>
where Mempool: Service<Request, Response = Response, Error = BoxError> + Clone + Send + Sync + 'static, Mempool::Future: Send, State: Service<ReadRequest, Response = ReadResponse, Error = BoxError> + Clone + Send + Sync + 'static, <State as Service<ReadRequest>>::Future: Send, Tip: ChainTip + Clone + Send + Sync + 'static, BlockVerifierRouter: Service<Request, Response = Hash, Error = BoxError> + Clone + Send + Sync + 'static, <BlockVerifierRouter as Service<Request>>::Future: Send, SyncStatus: ChainSyncStatus + Clone + Send + Sync + 'static, AddressBook: AddressBookPeers + Clone + Send + Sync + 'static,
Expand description

Runs a single mining thread that gets blocks from the template_receiver, calculates equihash solutions with nonces based on solver_id, and submits valid blocks to Zebra’s block validator.

This method is CPU and memory-intensive. It uses 144 MB of RAM and one CPU core while running. It can run for minutes or hours if the network difficulty is high. Mining uses a thread with low CPU priority.