PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
CBlockIndex Class Reference

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. More...

#include <chain.h>

Inheritance diagram for CBlockIndex:
[legend]
Collaboration diagram for CBlockIndex:
[legend]

Public Member Functions

 CBlockIndex ()
 
 CBlockIndex (const CBlock &block)
 
std::string ToString () const
 
FlatFilePos GetBlockPos () const
 
FlatFilePos GetUndoPos () const
 
CBlockHeader GetBlockHeader () const
 
uint256 GetBlockHash () const
 
int64_t GetBlockTime () const
 
int64_t GetBlockTimeMax () const
 
int64_t GetMedianTimePast () const
 
int64_t MaxFutureBlockTime () const
 
int64_t MinPastBlockTime () const
 
bool IsProofOfStake () const
 
bool IsProofOfWork () const
 
void SetProofOfStake ()
 
unsigned int GetStakeEntropyBit () const
 
bool SetStakeEntropyBit (unsigned int nEntropyBit)
 
bool GeneratedStakeModifier () const
 
void SetStakeModifier (const uint64_t nStakeModifier, bool fGeneratedStakeModifier)
 
void SetNewStakeModifier ()
 
void SetStakeModifier (const uint256 &nStakeModifier)
 
void SetNewStakeModifier (const uint256 &prevoutId)
 
uint64_t GetStakeModifierV1 () const
 
uint256 GetStakeModifierV2 () const
 
void SetChainSaplingValue ()
 
bool IsValid (enum BlockStatus nUpTo=BLOCK_VALID_TRANSACTIONS) const
 Check whether this block index entry is valid up to the passed validity level. More...
 
bool RaiseValidity (enum BlockStatus nUpTo)
 Raise the validity level of this block index entry. More...
 
void BuildSkip ()
 Build the skiplist pointer for this entry. More...
 
CBlockIndexGetAncestor (int height)
 Efficiently find an ancestor of this block. More...
 
const CBlockIndexGetAncestor (int height) const
 

Public Attributes

const uint256phashBlock {nullptr}
 pointer to the hash of the block, if any. memory is owned by this CBlockIndex More...
 
CBlockIndexpprev {nullptr}
 pointer to the index of the predecessor of this block More...
 
CBlockIndexpskip {nullptr}
 pointer to the index of some further predecessor of this block More...
 
int nHeight {0}
 height of the entry in the chain. The genesis block has height 0 More...
 
int nFile {0}
 Which # file this block is stored in (blk?????.dat) More...
 
unsigned int nDataPos {0}
 Byte offset within blk?????.dat where this block's data is stored. More...
 
unsigned int nUndoPos {0}
 Byte offset within rev?????.dat where this block's undo data is stored. More...
 
arith_uint256 nChainWork {}
 (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block More...
 
unsigned int nTx {0}
 Number of transactions in this block. More...
 
unsigned int nChainTx {0}
 (memory only) Number of transactions in the chain up to and including this block. More...
 
uint32_t nStatus {0}
 Verification status of this block. See enum BlockStatus. More...
 
std::vector< unsigned char > vStakeModifier {}
 
unsigned int nFlags {0}
 
CAmount nSaplingValue {0}
 Change in value held by the Sapling circuit over this block. More...
 
Optional< CAmountnChainSaplingValue {nullopt}
 (memory only) Total value held by the Sapling circuit up to and including this block. More...
 
int32_t nVersion {0}
 block header More...
 
uint256 hashMerkleRoot {}
 
uint256 hashFinalSaplingRoot {}
 
uint32_t nTime {0}
 
uint32_t nBits {0}
 
uint32_t nNonce {0}
 
uint256 nAccumulatorCheckpoint {}
 
uint32_t nSequenceId {0}
 (memory only) Sequential id assigned to distinguish order in which blocks are received. More...
 
unsigned int nTimeMax {0}
 (memory only) Maximum nTime in the chain upto and including this block. More...
 

Detailed 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.

Definition at line 138 of file chain.h.

Constructor & Destructor Documentation

◆ CBlockIndex() [1/2]

CBlockIndex::CBlockIndex ( )
inline

Definition at line 207 of file chain.h.

◆ CBlockIndex() [2/2]

CBlockIndex::CBlockIndex ( const CBlock block)
explicit

Definition at line 124 of file chain.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ BuildSkip()

void CBlockIndex::BuildSkip ( )

Build the skiplist pointer for this entry.

Definition at line 118 of file chain.cpp.

Here is the call graph for this function:

◆ GeneratedStakeModifier()

bool CBlockIndex::GeneratedStakeModifier ( ) const
inline

Definition at line 231 of file chain.h.

Here is the caller graph for this function:

◆ GetAncestor() [1/2]

CBlockIndex * CBlockIndex::GetAncestor ( int  height)

Efficiently find an ancestor of this block.

Definition at line 113 of file chain.cpp.

Here is the caller graph for this function:

◆ GetAncestor() [2/2]

const CBlockIndex * CBlockIndex::GetAncestor ( int  height) const

Definition at line 88 of file chain.cpp.

◆ GetBlockHash()

uint256 CBlockIndex::GetBlockHash ( ) const
inline

Definition at line 215 of file chain.h.

◆ GetBlockHeader()

CBlockHeader CBlockIndex::GetBlockHeader ( ) const

Definition at line 166 of file chain.cpp.

Here is the call graph for this function:

◆ GetBlockPos()

FlatFilePos CBlockIndex::GetBlockPos ( ) const

Definition at line 146 of file chain.cpp.

Here is the caller graph for this function:

◆ GetBlockTime()

int64_t CBlockIndex::GetBlockTime ( ) const
inline

Definition at line 216 of file chain.h.

Here is the caller graph for this function:

◆ GetBlockTimeMax()

int64_t CBlockIndex::GetBlockTimeMax ( ) const
inline

Definition at line 217 of file chain.h.

Here is the caller graph for this function:

◆ GetMedianTimePast()

int64_t CBlockIndex::GetMedianTimePast ( ) const

Definition at line 204 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStakeEntropyBit()

unsigned int CBlockIndex::GetStakeEntropyBit ( ) const

Definition at line 218 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStakeModifierV1()

uint64_t CBlockIndex::GetStakeModifierV1 ( ) const

Definition at line 279 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStakeModifierV2()

uint256 CBlockIndex::GetStakeModifierV2 ( ) const

Definition at line 289 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUndoPos()

FlatFilePos CBlockIndex::GetUndoPos ( ) const

Definition at line 156 of file chain.cpp.

◆ IsProofOfStake()

bool CBlockIndex::IsProofOfStake ( ) const
inline

Definition at line 224 of file chain.h.

Here is the caller graph for this function:

◆ IsProofOfWork()

bool CBlockIndex::IsProofOfWork ( ) const
inline

Definition at line 225 of file chain.h.

Here is the call graph for this function:

◆ IsValid()

bool CBlockIndex::IsValid ( enum BlockStatus  nUpTo = BLOCK_VALID_TRANSACTIONS) const

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

Definition at line 313 of file chain.cpp.

Here is the caller graph for this function:

◆ MaxFutureBlockTime()

int64_t CBlockIndex::MaxFutureBlockTime ( ) const

Definition at line 180 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MinPastBlockTime()

int64_t CBlockIndex::MinPastBlockTime ( ) const

Definition at line 185 of file chain.cpp.

Here is the call graph for this function:

◆ RaiseValidity()

bool CBlockIndex::RaiseValidity ( enum BlockStatus  nUpTo)

Raise the validity level of this block index entry.

Returns true if the validity was changed.

Definition at line 323 of file chain.cpp.

◆ SetChainSaplingValue()

void CBlockIndex::SetChainSaplingValue ( )

Definition at line 298 of file chain.cpp.

◆ SetNewStakeModifier() [1/2]

void CBlockIndex::SetNewStakeModifier ( )

Definition at line 245 of file chain.cpp.

Here is the call graph for this function:

◆ SetNewStakeModifier() [2/2]

void CBlockIndex::SetNewStakeModifier ( const uint256 prevoutId)

Definition at line 265 of file chain.cpp.

Here is the call graph for this function:

◆ SetProofOfStake()

void CBlockIndex::SetProofOfStake ( )
inline

Definition at line 226 of file chain.h.

Here is the caller graph for this function:

◆ SetStakeEntropyBit()

bool CBlockIndex::SetStakeEntropyBit ( unsigned int  nEntropyBit)

Definition at line 224 of file chain.cpp.

Here is the caller graph for this function:

◆ SetStakeModifier() [1/2]

void CBlockIndex::SetStakeModifier ( const uint256 nStakeModifier)

Definition at line 258 of file chain.cpp.

Here is the call graph for this function:

◆ SetStakeModifier() [2/2]

void CBlockIndex::SetStakeModifier ( const uint64_t  nStakeModifier,
bool  fGeneratedStakeModifier 
)

Definition at line 233 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

std::string CBlockIndex::ToString ( ) const

Definition at line 138 of file chain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ hashFinalSaplingRoot

uint256 CBlockIndex::hashFinalSaplingRoot {}

Definition at line 195 of file chain.h.

◆ hashMerkleRoot

uint256 CBlockIndex::hashMerkleRoot {}

Definition at line 194 of file chain.h.

◆ nAccumulatorCheckpoint

uint256 CBlockIndex::nAccumulatorCheckpoint {}

Definition at line 199 of file chain.h.

◆ nBits

uint32_t CBlockIndex::nBits {0}

Definition at line 197 of file chain.h.

◆ nChainSaplingValue

Optional<CAmount> CBlockIndex::nChainSaplingValue {nullopt}

(memory only) Total value held by the Sapling circuit up to and including this block.

Will be nullopt if nChainTx is zero.

Definition at line 190 of file chain.h.

◆ nChainTx

unsigned int CBlockIndex::nChainTx {0}

(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 when necessary; won't happen before 2030

Definition at line 172 of file chain.h.

◆ nChainWork

arith_uint256 CBlockIndex::nChainWork {}

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

Definition at line 163 of file chain.h.

◆ nDataPos

unsigned int CBlockIndex::nDataPos {0}

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

Definition at line 157 of file chain.h.

◆ nFile

int CBlockIndex::nFile {0}

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

Definition at line 154 of file chain.h.

◆ nFlags

unsigned int CBlockIndex::nFlags {0}

Definition at line 181 of file chain.h.

◆ nHeight

int CBlockIndex::nHeight {0}

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

Definition at line 151 of file chain.h.

◆ nNonce

uint32_t CBlockIndex::nNonce {0}

Definition at line 198 of file chain.h.

◆ nSaplingValue

CAmount CBlockIndex::nSaplingValue {0}

Change in value held by the Sapling circuit over this block.

Not a Optional because this was added before Sapling activated, so we can rely on the invariant that every block before this was added had nSaplingValue = 0.

Definition at line 186 of file chain.h.

◆ nSequenceId

uint32_t CBlockIndex::nSequenceId {0}

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

Definition at line 202 of file chain.h.

◆ nStatus

uint32_t CBlockIndex::nStatus {0}

Verification status of this block. See enum BlockStatus.

Definition at line 175 of file chain.h.

◆ nTime

uint32_t CBlockIndex::nTime {0}

Definition at line 196 of file chain.h.

◆ nTimeMax

unsigned int CBlockIndex::nTimeMax {0}

(memory only) Maximum nTime in the chain upto and including this block.

Definition at line 205 of file chain.h.

◆ nTx

unsigned int CBlockIndex::nTx {0}

Number of transactions in this block.

Note: in a potential headers-first mode, this number cannot be relied upon

Definition at line 167 of file chain.h.

◆ nUndoPos

unsigned int CBlockIndex::nUndoPos {0}

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

Definition at line 160 of file chain.h.

◆ nVersion

int32_t CBlockIndex::nVersion {0}

block header

Definition at line 193 of file chain.h.

◆ phashBlock

const uint256* CBlockIndex::phashBlock {nullptr}

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

Definition at line 142 of file chain.h.

◆ pprev

CBlockIndex* CBlockIndex::pprev {nullptr}

pointer to the index of the predecessor of this block

Definition at line 145 of file chain.h.

◆ pskip

CBlockIndex* CBlockIndex::pskip {nullptr}

pointer to the index of some further predecessor of this block

Definition at line 148 of file chain.h.

◆ vStakeModifier

std::vector<unsigned char> CBlockIndex::vStakeModifier {}

Definition at line 180 of file chain.h.


The documentation for this class was generated from the following files: