pub struct BlockIndex {
Show 18 fields pub phash_block: Option<u256>, pub pprev: Option<Arc<BlockIndex>>, pub pskip: Option<Arc<BlockIndex>>, pub n_height: i32, pub n_file: i32, pub n_data_pos: u32, pub n_undo_pos: u32, pub n_chain_work: ArithU256, pub n_tx: u32, pub n_chain_tx: u32, pub n_status: u32, pub n_version: i32, pub hash_merkle_root: u256, pub n_time: u32, pub n_bits: u32, pub n_nonce: u32, pub n_sequence_id: i32, pub n_time_max: u32,
}
Expand 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. |

Fields§

§phash_block: Option<u256>

| pointer to the hash of the block, if any. | Memory is owned by this CBlockIndex |

§pprev: Option<Arc<BlockIndex>>

| pointer to the index of the predecessor | of this block |

§pskip: Option<Arc<BlockIndex>>

| pointer to the index of some further | predecessor of this block |

§n_height: i32

| height of the entry in the chain. The | genesis block has height 0 |

§n_file: i32

| Which # file this block is stored in (blk?????.dat) |

§n_data_pos: u32

| Byte offset within blk?????.dat where | this block’s data is stored |

§n_undo_pos: u32

| Byte offset within rev?????.dat where | this block’s undo data is stored |

§n_chain_work: ArithU256

| (memory only) Total amount of work (expected | number of hashes) in the chain up to and | including this block |

§n_tx: u32

| Number of transactions in this block. | | Note: in a potential headers-first mode, | this number cannot be relied upon | | Note: this value is faked during UTXO | snapshot load to ensure that | LoadBlockIndex() will load index entries | for blocks that we lack data for. | | @sa ActivateSnapshot

§n_chain_tx: u32

| (memory only) Number of transactions in the | chain up to and including this block. | | This value will be non-zero only if and | only if transactions for this block and all | its parents are available. | | Change to 64-bit type before 2024 (assuming | worst case of 60 byte transactions). | | Note: this value is faked during use of | a UTXO snapshot because we don’t have the | underlying block data available during | snapshot load. | | @sa AssumeutxoData @sa ActivateSnapshot

§n_status: u32

| Verification status of this block. See enum | BlockStatus | | Note: this value is modified to show | BLOCK_OPT_WITNESS during UTXO snapshot load | to avoid the block index being spuriously | rewound. | | @sa NeedsRedownload @sa ActivateSnapshot

§n_version: i32

| block header |

§hash_merkle_root: u256§n_time: u32§n_bits: u32§n_nonce: u32§n_sequence_id: i32

| (memory only) Sequential id assigned | to distinguish order in which blocks | are received. |

§n_time_max: u32

| (memory only) Maximum nTime in the chain | up to and including this block. |

Implementations§

| Check whether this block’s and all previous | blocks’ transactions have been downloaded | (and stored to disk) at some point. | | Does not imply the transactions are | consensus-valid (ConnectTip might | fail) | | Does not imply the transactions are | still stored on disk. (IsBlockPruned | might return true) |

| Check whether this block index entry | is valid up to the passed validity level. |

| @returns true if the block is | assumed-valid; this means it is queued | to be validated by a background | chainstate.

| Raise the validity level of this block | index entry. | | Returns true if the validity was changed.

| Efficiently find an ancestor of this | block. |

| Build the skiplist pointer for this | entry. |

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Performs the conversion. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Convert type of a const pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.