Used to marshal pointers into hashes for db storage.
Synopsis
Declared in <chain.h>
class CDiskBlockIndex
: public CBlockIndex
Base Classes
Name |
Description |
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. |
Member Functions
Name |
Description |
|
Constructors |
Build the skiplist pointer for this entry. |
|
Recomputes the block hash from the stored header fields. |
|
|
|
|
|
Reconstructs the block header for this entry. |
|
Returns the on‐disk position of this block's data. |
|
Returns this block's timestamp. |
|
Returns the maximum timestamp seen in the chain up to and including this block. |
|
Returns the median timestamp of the previous nMedianTimeSpan blocks. |
|
Returns the on‐disk position of this block's undo data. |
|
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. |
|
Check whether this block index entry is valid up to the passed validity level. |
|
Raise the validity level of this block index entry. Returns true if the validity was changed. |
|
Returns this block's timestamp as a time point. |
|
|
Data Members
Name |
Description |
Merkle root of the block's transactions |
|
Hash of the predecessor block, stored explicitly for on‐disk serialization. |
|
(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. |
|
Compact‐encoded proof‐of‐work difficulty target |
|
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this block |
|
Byte offset within blk?????.dat where this block's data is stored |
|
Which # file this block is stored in (blk?????.dat) |
|
height of the entry in the chain. The genesis block has height 0 |
|
Proof‐of‐work nonce |
|
(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}. |
|
Verification status of this block. See enum BlockStatus |
|
Block timestamp, in seconds since the Unix epoch |
|
(memory only) Maximum nTime in the chain up to and including this block. |
|
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 |
|
Byte offset within rev?????.dat where this block's undo data is stored |
|
block header |
|
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex |
|
pointer to the index of the predecessor of this block |
|
pointer to the index of some further predecessor of this block |
Static Data Members
Name |
Description |
Number of blocks considered when computing the median time past. |
Protected Member Functions
Name |
Description |
Assignment operators |
Non-Member Functions
Name |
Description |
Calculate LockPoints required to check if transaction will be BIP68 final in the next block to be created on top of tip. |
|
Compute the retargeted proof‐of‐work target after a difficulty adjustment interval. |
|
Check if transaction will be final in the next block to be created. |
|
Check if transaction will be BIP68 final in the next block to be created on top of tip. |
|
Determine if a deployment is active for the next block |
|
Determine if a version‐bits deployment is active for the next block. |
|
Whether a deployment is active after the given block, resolved via ChainstateManager. |
|
Determine if a version‐bits deployment is active for this block. |
|
Whether a deployment is active at the given block, resolved via ChainstateManager. |
|
Determine if a deployment is active for this block |
|
Checks whether previously computed sequence locks are satisfied by a block. |
|
Compute how much work a block index entry corresponds to. |
|
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. |
|
Return the script flags which should be checked for a given block. |
|
Get the difficulty of the net wrt to the given block index. |
|
Get a locator for a block index entry. |
|
Compute the proof‐of‐work target (nBits) required for the block following pindexLast. |
|
* Get the target for a given block index. |
|
Identifies blocks that overwrote an existing coinbase output in the UTXO set (see BIP30). |
|
Find the forking point between two chain tips. |
|
Construct a list of hash entries to put in a locator. |
|
Return an empty block index on top of the tip, with height, time and nBits set |
|
Block header to JSON |
|
Builds block metadata from a block index entry. |
|
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. |
|
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. |
Created with MrDocs