Module zebra_chain::work::difficulty
source · Expand description
Block difficulty data structures and calculations
The block difficulty “target threshold” is stored in the block header as a
32-bit CompactDifficulty
. The block::Hash
must be less than or equal
to the ExpandedDifficulty
threshold, when represented as a 256-bit integer
in little-endian order.
The target threshold is also used to calculate the Work
for each block.
The block work is used to find the chain with the greatest total work. Each
block’s work value depends on the fixed threshold in the block header, not
the actual work represented by the block header hash.
Modules§
Structs§
- A 32-bit “compact bits” value, which represents the difficulty threshold for a block header.
- A 256-bit unsigned “expanded difficulty” value.
- Partial work used to track relative work in non-finalized chains
- Little-endian large integer type
- A 128-bit unsigned “Work” value.
Constants§
- An invalid CompactDifficulty value, for testing.
Traits§
- Network methods related to Difficulty