Expand description
Internal mining in Zebra.
§TODO
- pause mining if we have no peers, like
zcashd
does, and add a developer config that mines regardless of how many peers we have. https://github.com/zcash/zcash/blob/6fdd9f1b81d3b228326c9826fa10696fc516444b/src/miner.cpp#L865-L880 - move common code into zebra-chain or zebra-node-services and remove the RPC dependency.
Constants§
- How long we wait after mining a block, before expecting a new template.
- A rate-limit for block template refreshes.
- The amount of time we wait between block template retries.
Functions§
- Generates block templates using
rpc
, and sends them to mining threads usingtemplate_sender
. - Initialize the miner based on its config.
- 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 eachsolver_id
. - Runs a single mining thread that gets blocks from the
template_receiver
, calculates equihash solutions with nonces based onsolver_id
, and submits valid blocks to Zebra’s block validator. - Initialize the miner based on its config, and spawn a task for it.