Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <chain.h>
Go to the source code of this file.
Functions | |
static int | InvertLowestOne (int n) |
Turn the lowest '1' bit in the binary representation of a number into a '0'. More... | |
static int | GetSkipHeight (int height) |
Compute what height to jump back to with the CBlockIndex::pskip pointer. More... | |
arith_uint256 | GetBlockProof (const CBlockIndex &block) |
int64_t | GetBlockProofEquivalentTime (const CBlockIndex &to, const CBlockIndex &from, const CBlockIndex &tip, const Consensus::Params ¶ms) |
Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. More... | |
const CBlockIndex * | LastCommonAncestor (const CBlockIndex *pa, const CBlockIndex *pb) |
Find the last common ancestor two blocks have. More... | |
Function Documentation
◆ GetBlockProof()
arith_uint256 GetBlockProof | ( | const CBlockIndex & | block | ) |
Definition at line 121 of file chain.cpp.
References CBlockIndex::nBits, and arith_uint256::SetCompact().
Referenced by CChainState::AddToBlockIndex(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), GetBlockProofEquivalentTime(), and CChainState::LoadBlockIndex().
◆ GetBlockProofEquivalentTime()
int64_t GetBlockProofEquivalentTime | ( | const CBlockIndex & | to, |
const CBlockIndex & | from, | ||
const CBlockIndex & | tip, | ||
const Consensus::Params & | |||
) |
Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds.
Definition at line 136 of file chain.cpp.
References base_uint< BITS >::bits(), GetBlockProof(), base_uint< BITS >::GetLow64(), CBlockIndex::nChainWork, and Consensus::Params::nPowTargetSpacing.
Referenced by BlockRequestAllowed(), and CChainState::ConnectBlock().
◆ GetSkipHeight()
|
inlinestatic |
Compute what height to jump back to with the CBlockIndex::pskip pointer.
Definition at line 73 of file chain.cpp.
References InvertLowestOne().
Referenced by CBlockIndex::BuildSkip(), and CBlockIndex::GetAncestor().
◆ InvertLowestOne()
|
inlinestatic |
Turn the lowest '1' bit in the binary representation of a number into a '0'.
Definition at line 70 of file chain.cpp.
Referenced by GetSkipHeight().
◆ LastCommonAncestor()
const CBlockIndex* LastCommonAncestor | ( | const CBlockIndex * | pa, |
const CBlockIndex * | pb | ||
) |
Find the last common ancestor two blocks have.
Find the forking point between two chain tips.
Both pa and pb must be non-nullptr.
Definition at line 155 of file chain.cpp.
References CBlockIndex::GetAncestor(), CBlockIndex::nHeight, and CBlockIndex::pprev.
Referenced by CChainState::ReplayBlocks().