The block chain is a tree shaped structure starting with the genesis block at the root, with each block potentially having multiple candidates to be the next block. A blockindex may have multiple pprev pointing to it, but at most one of them can be part of the currently active branch.
Declared in <chain.h>
class CBlockIndex;
| Name | Description |
|---|---|
CBlockIndex [constructor] | Constructors |
~CBlockIndex [destructor] | Destroys the block index entry. |
BuildSkip | Build the skiplist pointer for this entry. |
GetAncestor | GetAncestor overloads |
GetBlockHash | Returns the hash of this block. |
GetBlockHeader | Reconstructs the block header for this entry. |
GetBlockPos | Returns the on-disk position of this block's data. |
GetBlockTime | Returns this block's timestamp. |
GetBlockTimeMax | Returns the maximum timestamp seen in the chain up to and including this block. |
GetMedianTimePast | Returns the median timestamp of the previous nMedianTimeSpan blocks. |
GetUndoPos | Returns the on-disk position of this block's undo data. |
HaveNumChainTxs | Check whether this block and all previous blocks back to the genesis block or an assumeutxo snapshot block have reached VALID_TRANSACTIONS and had transactions downloaded (and stored to disk) at some point. |
IsValid | Check whether this block index entry is valid up to the passed validity level. |
RaiseValidity | Raise the validity level of this block index entry. Returns true if the validity was changed. |
Time | Returns this block's timestamp as a time point. |
ToString | Returns a human-readable description of this block index entry. |
| Name | Description |
|---|---|
hashMerkleRoot | Merkle root of the block's transactions |
m_chain_tx_count | (memory only) Number of transactions in the chain up to and including this block. This value will be non-zero if this block and all previous blocks back to the genesis block or an assumeutxo snapshot block have reached the VALID_TRANSACTIONS level. |
nBits | Compact-encoded proof-of-work difficulty target |
nChainWork | (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block |
nDataPos | Byte offset within blk?????.dat where this block's data is stored |
nFile | Which # file this block is stored in (blk?????.dat) |
nHeight | height of the entry in the chain. The genesis block has height 0 |
nNonce | Proof-of-work nonce |
nSequenceId | (memory only) Sequential id assigned to distinguish order in which blocks are received. Initialized to SEQ_ID_INIT_FROM_DISK{1} when loading blocks from disk, except for blocks belonging to the best chain which overwrite it to SEQ_ID_BEST_CHAIN_FROM_DISK{0}. |
nStatus | Verification status of this block. See enum BlockStatus |
nTime | Block timestamp, in seconds since the Unix epoch |
nTimeMax | (memory only) Maximum nTime in the chain up to and including this block. |
nTx | Number of transactions in this block. This will be nonzero if the block reached the VALID_TRANSACTIONS level, and zero otherwise. Note: in a potential headers-first mode, this number cannot be relied upon |
nUndoPos | Byte offset within rev?????.dat where this block's undo data is stored |
nVersion | block header |
phashBlock | pointer to the hash of the block, if any. Memory is owned by this CBlockIndex |
pprev | pointer to the index of the predecessor of this block |
pskip | pointer to the index of some further predecessor of this block |
| Name | Description |
|---|---|
nMedianTimeSpan | Number of blocks considered when computing the median time past. |
| Name | Description |
|---|---|
CBlockIndex [constructor] | Constructors |
operator= | Assignment operators |
| Name | Description |
|---|---|
CalculateLockPointsAtTip | Calculate LockPoints required to check if transaction will be BIP68 final in the next block to be created on top of tip. |
CalculateNextWorkRequired | Compute the retargeted proof-of-work target after a difficulty adjustment interval. |
CheckFinalTxAtTip | Check if transaction will be final in the next block to be created. |
CheckSequenceLocksAtTip | Check if transaction will be BIP68 final in the next block to be created on top of tip. |
DeploymentActiveAfter | Determine if a deployment is active for the next block |
DeploymentActiveAfter | Determine if a version-bits deployment is active for the next block. |
DeploymentActiveAfter | Whether a deployment is active after the given block, resolved via ChainstateManager. |
DeploymentActiveAt | Determine if a version-bits deployment is active for this block. |
DeploymentActiveAt | Whether a deployment is active at the given block, resolved via ChainstateManager. |
DeploymentActiveAt | Determine if a deployment is active for this block |
EvaluateSequenceLocks | Checks whether previously computed sequence locks are satisfied by a block. |
GetBlockProof | Compute how much work a block index entry corresponds to. |
GetBlockProofEquivalentTime | 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. |
GetBlockScriptFlags | Return the script flags which should be checked for a given block. |
GetDifficulty | Get the difficulty of the net wrt to the given block index. |
GetLocator | Get a locator for a block index entry. |
GetNextWorkRequired | Compute the proof-of-work target (nBits) required for the block following pindexLast. |
GetTarget | * Get the target for a given block index. |
IsBIP30Repeat | Identifies blocks that overwrote an existing coinbase output in the UTXO set (see BIP30). |
LastCommonAncestor | Find the forking point between two chain tips. |
LocatorEntries | Construct a list of hash entries to put in a locator. |
NextEmptyBlockIndex | Return an empty block index on top of the tip, with height, time and nBits set |
blockheaderToJSON | Block header to JSON |
kernel::MakeBlockInfo | Builds block metadata from a block index entry. |
node::GetMinimumTime | Get the minimum time a miner should use in the next block. This always accounts for the BIP94 timewarp rule, so does not necessarily reflect the consensus limit. |
node::GetTransaction | Return transaction with a given hash. If mempool is provided and block_index is not provided, check it first for the tx. If -txindex is available, check it next for the tx. Finally, if block_index is provided, check for tx by reading entire block from disk. |
| Name | Description |
|---|---|
CDiskBlockIndex | Used to marshal pointers into hashes for db storage. |