Convert boundary to its original difficulty. Basically just f(x) = 2^256 / x
.
Compute [2^256 / x], where x >= 2 and x < 2^256.
Convert difficulty to the target boundary. Basically just f(x) = 2^256 / x
.
This should only be used in tests.
This function computes the target difficulty of the next period
based on the current period. cur_hash
should be the hash of
the block at the current period upper boundary and it must have been
inserted to BlockDataManager, otherwise the function will panic.
num_blocks_in_epoch
is a function that returns the epoch size
under the epoch view of a given block.