32 "CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
pprev,
37 if (height >
nHeight || height < 0) {
43 while (heightWalk > height) {
46 if (pindexWalk->
pskip !=
nullptr &&
47 (heightSkip == height ||
48 (heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
49 heightSkipPrev >= height)))) {
51 pindexWalk = pindexWalk->
pskip;
52 heightWalk = heightSkip;
55 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'.
The block chain is a tree shaped structure starting with the genesis block at the root,...
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.
CBlockIndex * pskip
pointer to the index of some further predecessor of 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
std::string ToString() const