darkfi::validator

Module pow

Source
Expand description

DarkFi PoW module

Structsยง

  • This struct represents the information required by the PoW algorithm

Constantsยง

  • How many most recent blocks to use to verify new blocksโ€™ timestamp
  • Time limit in the future of what blocks can be
  • BUF_SIZE ๐Ÿ”’
    Ring buffer length. Must be == DIFFICULTY_WINDOW + DIFFICULTY_LAG
  • CUT_BEGIN ๐Ÿ”’
    Already known cutoff start index for this config
  • CUT_END ๐Ÿ”’
    Already known cutoff end index for this config
  • DIFFICULTY_WINDOW ๐Ÿ”’
    Amount of max items(blocks) to use for next difficulty calculation. Must be >= 2 and == BUF_SIZE - DIFFICULTY_LAG.
  • RETAINED ๐Ÿ”’
    Max items to use for next difficulty calculation. Must be DIFFICULTY_WINDOW - 2 * DIFFICULTY_CUT
  • _DIFFICULTY_CUT ๐Ÿ”’
    Used to calculate how many items to retain for next difficulty calculation. We are keeping the middle items, meaning cutting both from frond and back of the ring buffer, ending up with max DIFFICULTY_WINDOW - 2DIFFICULTY_CUT items. (2DIFFICULTY_CUT <= DIFFICULTY_WINDOW-2) must be true.
  • _DIFFICULTY_LAG ๐Ÿ”’
    Amount of latest blocks to exlude from the calculation. Our ring buffer has length: DIFFICULTY_WINDOW + DIFFICULTY_LAG, but we only use DIFFICULTY_WINDOW items in calculations. Must be == BUF_SIZE - DIFFICULTY_WINDOW.

Functionsยง

  • Mine provided block, based on provided PoW module next mine target.