Documentation ¶
Index ¶
Constants ¶
const ( // New challenge is calculated based on 10 blocks before. ChallengeInterval = 10 MaxReferredBlocks = ChallengeInterval * 2 )
Variables ¶
This section is empty.
Functions ¶
func CalcNextChallenge ¶
calcNextChallenge calculates the required challenge for the block after the passed previous block node based on the challenge adjustment rules. This function differs from the exported CalcNextChallenge in that, the exported version uses the current best chain as the previous block node while this function accepts any block node.
The calculation of next challenge accords to rules as followed:
If the best block height ranges in [0, <ChallengeInterval>), then we use the block hash of last block as next Challenge.
Else we calc (M = <best block height> mod <ChallengeInterval>), operating M times of Hash function to proof hash of certain block, use the result as next Challenge.
Types ¶
This section is empty.