32 "CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
pprev,
48 is_snapshot_base_block)) {
49 LogPrintf(
"Internal bug detected: block %d has unexpected nChainTx %i "
50 "that should be %i. Please report this issue here: %s\n",
63 LogPrintf(
"Internal bug detected: block %d has unexpected nChainTx %i "
64 "that should be %i. Please report this issue here: %s\n",
77 if (height >
nHeight || height < 0) {
83 while (heightWalk > height) {
86 if (pindexWalk->
pskip !=
nullptr &&
87 (heightSkip == height ||
88 (heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
89 heightSkipPrev >= height)))) {
91 pindexWalk = pindexWalk->
pskip;
92 heightWalk = heightSkip;
95 pindexWalk = pindexWalk->
pprev;
static int GetSkipHeight(int height)
Compute what height to jump back to with the CBlockIndex::pskip pointer.
static int InvertLowestOne(int n)
Turn the lowest '1' bit in the binary representation of a number into a '0'.
#define Assume(val)
Assume is the identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
void ResetChainStats()
Reset chain tx stats.
std::string ToString() const
CBlockIndex * pprev
pointer to the index of the predecessor of this block
void BuildSkip()
Build the skiplist pointer for this entry.
void MaybeResetChainStats(bool is_snapshot_base_block)
Reset chain tx stats and log a warning if the block is not the snapshot block, and the nChainTx value...
bool UpdateChainStats()
Update chain tx stats and return True if this block is the genesis block or all parents have their tx...
CBlockIndex * pskip
pointer to the index of some further predecessor of this block
unsigned int nTx
Number of transactions in this block.
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
BlockHash GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
unsigned int nChainTx
(memory only) Number of transactions in the chain up to and including this block.
std::string ToString() const