8#include <chainparams.h>
11#include <test/util/setup_common.h>
13#include <boost/test/unit_test.hpp>
32 std::vector<CBlockIndex> blocks(3000);
42 blocks[0].nHeight = 0;
43 blocks[0].nTime = 1269211443;
52 for (i = 1; i < 2050; i++) {
61 for (
size_t j = 0;
j < 10; i++,
j++) {
73 blocks[i] =
GetBlockIndex(&blocks[i - 1], 2 * 600 - 6000, nBits);
79 for (
size_t j = 0;
j < 20; i++,
j++) {
91 for (
size_t j = 0;
j < 10; i++,
j++) {
112 for (
size_t j = 0;
j < 20; i++,
j++) {
141 for (
size_t j = 0;
j < 93; i++,
j++) {
170 for (
size_t j = 0;
j < 192; i++,
j++) {
193 for (
size_t j = 0;
j < 5; i++,
j++) {
205 for (
size_t j = 0;
j < 130; i++,
j++) {
225 for (
size_t j = 0;
j < 70; i++,
j++) {
arith_uint256 UintToArith256(const uint256 &a)
arith_uint256 GetBlockProof(const CBlockIndex &block)
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
int nHeight
height of the entry in the chain. The genesis block has height 0
256-bit unsigned big integer.
arith_uint256 & SetCompact(uint32_t nCompact, bool *pfNegative=nullptr, bool *pfOverflow=nullptr)
The "compact" format is a representation of a whole number N using an unsigned 32bit number similar t...
uint32_t GetCompact(bool fNegative=false) const
uint32_t GetNextDAAWorkRequired(const CBlockIndex *pindexPrev, const CBlockHeader *pblock, const Consensus::Params ¶ms)
Compute the next required proof of work using a weighted average of the estimated hashrate per block.
static CBlockIndex GetBlockIndex(CBlockIndex *pindexPrev, int64_t nTimeInterval, uint32_t nBits)
BOOST_AUTO_TEST_CASE(daa_test)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Parameters that influence chain consensus.
uint256 powLimit
Proof of work parameters.