Module difficulty

Source
Expand description

Block difficulty adjustment calculations for contextual validation.

This module supports the following consensus rule calculations:

  • ThresholdBits from the Zcash Specification,
  • the Testnet minimum difficulty adjustment from ZIPs 205 and 208, and
  • median-time-past.

Structs§

AdjustedDifficulty 🔒
Contains the context needed to calculate the adjusted difficulty for a block.

Constants§

BLOCK_MAX_TIME_SINCE_MEDIAN
The maximum number of seconds between the median-time-past of a block, and the block’s time field.
POW_ADJUSTMENT_BLOCK_SPAN
The overall block span used for adjusting Zcash block difficulty.
POW_DAMPING_FACTOR
The damping factor for median timespan variance.
POW_MAX_ADJUST_DOWN_PERCENT
The maximum downward adjustment percentage for median timespan variance.
POW_MAX_ADJUST_UP_PERCENT
The maximum upward adjustment percentage for median timespan variance.
POW_MEDIAN_BLOCK_SPAN
The median block span for time median calculations.