Author

Topic: what dose CBlockIndex's nHeight use for? (Read 617 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
October 09, 2016, 09:27:56 AM
#2
The CBlockIndex is used for indexing the blockchain. It is part of how Bitcoin Core keeps track of where each block is on the disk. The genesis block does not exist on the disk since it is never downloaded. Instead it is hardcoded into the software.
newbie
Activity: 15
Merit: 2
October 09, 2016, 02:03:11 AM
#1
class "CBlockIndex" has one data memeber: nHeight, note:"//! height of the entry in the chain. The genesis block has height 0"
it means the number of block in blockchain?
such as genesis block's nHeight is 0, second block's nHeight is 1...?if so, when i run bitcoind program, i add one line code ""LogPrintf("%s\n", pindexNew->ToString()) "" in CBlockTreeDB's LoadBlockIndexGuts function, but in the debug.log file, i have not see nHeight=0 which CBlockIndex record has.
when program starts to run, it reads block index data(or brief block header data) from disk?
Jump to: