Bitcoin ABC 0.30.7
P2P Digital Currency
Functions
pow.cpp File Reference
#include <pow/pow.h>
#include <arith_uint256.h>
#include <chain.h>
#include <chainparams.h>
#include <common/system.h>
#include <consensus/activation.h>
#include <consensus/params.h>
#include <pow/aserti32d.h>
#include <pow/daa.h>
#include <pow/eda.h>
#include <pow/grasberg.h>
#include <primitives/blockhash.h>
Include dependency graph for pow.cpp:

Go to the source code of this file.

Functions

uint32_t GetNextWorkRequired (const CBlockIndex *pindexPrev, const CBlockHeader *pblock, const CChainParams &chainParams)
 
bool PermittedDifficultyTransition (const Consensus::Params &params, int64_t height, uint32_t old_nbits, uint32_t new_nbits)
 Return false if the proof-of-work requirement specified by new_nbits at a given height is not possible, given the proof-of-work on the prior block as specified by old_nbits. More...
 
bool CheckProofOfWork (const BlockHash &hash, uint32_t nBits, const Consensus::Params &params)
 Check whether a block hash satisfies the proof-of-work requirement specified by nBits. More...
 
bool NBitsToTarget (const Consensus::Params &params, uint32_t nBits, arith_uint256 &target)
 Convert a header bits difficulty representation to a 256 bits hash target. More...
 

Function Documentation

◆ CheckProofOfWork()

bool CheckProofOfWork ( const BlockHash hash,
uint32_t  nBits,
const Consensus::Params params 
)

Check whether a block hash satisfies the proof-of-work requirement specified by nBits.

Definition at line 87 of file pow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNextWorkRequired()

uint32_t GetNextWorkRequired ( const CBlockIndex pindexPrev,
const CBlockHeader pblock,
const CChainParams chainParams 
)

Definition at line 21 of file pow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NBitsToTarget()

bool NBitsToTarget ( const Consensus::Params params,
uint32_t  nBits,
arith_uint256 target 
)

Convert a header bits difficulty representation to a 256 bits hash target.

Definition at line 102 of file pow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PermittedDifficultyTransition()

bool PermittedDifficultyTransition ( const Consensus::Params params,
int64_t  height,
uint32_t  old_nbits,
uint32_t  new_nbits 
)

Return false if the proof-of-work requirement specified by new_nbits at a given height is not possible, given the proof-of-work on the prior block as specified by old_nbits.

For blocks prior to the UAHF, this function only checks that the new value is within a factor of 4 of the old value for blocks at the difficulty adjustment interval, and otherwise requires the values to be the same.

For blocks after UAHF and before the switch to CW-144, the difficulty is allowed to change for any blocks, but still within a factor 4.

After the switch to the CW-144 DAA, any change in difficulty is theoretically possible, so always return true.

Always returns true on networks where min difficulty blocks are allowed, such as regtest/testnet.

Definition at line 47 of file pow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: