Bitcoin Forum
May 30, 2024, 10:25:43 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: what dose CBlockIndex's nHeight use for?  (Read 593 times)
lovecodelc (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 2


View Profile
October 09, 2016, 07: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?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
October 09, 2016, 02:27:56 PM
Merited by ABCbits (1)
 #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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!