Module miner

Source
Expand description

Internal mining in Zebra.

§TODO

Constants§

BLOCK_MINING_WAIT_TIME
How long we wait after mining a block, before expecting a new template.
BLOCK_TEMPLATE_REFRESH_LIMIT
A rate-limit for block template refreshes.
BLOCK_TEMPLATE_WAIT_TIME
The amount of time we wait between block template retries.

Functions§

generate_block_templates
Generates block templates using rpc, and sends them to mining threads using template_sender.
init
Initialize the miner based on its config.
mine_a_block
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.
run_mining_solver
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.
spawn_init
Initialize the miner based on its config, and spawn a task for it.