PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Types | Public Member Functions | Static 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 Types

enum  { BLOCK_PROOF_OF_STAKE = (1 << 0), BLOCK_STAKE_ENTROPY = (1 << 1), BLOCK_STAKE_MODIFIER = (1 << 2), BLOCK_PROOF_OF_AUDIT = (1 << 3) }
 
enum  { nMedianTimeSpan = 11 }
 

Public Member Functions

uint256 GetBlockTrust () const
 
void SetNull ()
 
 CBlockIndex ()
 
 CBlockIndex (const CBlock &block)
 
CDiskBlockPos GetBlockPos () const
 
CDiskBlockPos GetUndoPos () const
 
CBlockHeader GetBlockHeader () const
 
uint256 GetBlockHash () const
 
int64_t GetBlockTime () const
 
int64_t GetMedianTimePast () const
 
bool IsProofOfWork () const
 
bool IsProofOfStake () const
 
void SetProofOfStake ()
 
bool IsProofOfAudit () const
 
void SetProofOfAudit ()
 
unsigned int GetStakeEntropyBit () const
 
bool SetStakeEntropyBit (unsigned int nEntropyBit)
 
bool GeneratedStakeModifier () const
 
void SetStakeModifier (uint64_t nModifier, bool fGeneratedStakeModifier)
 
std::string ToString () const
 
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
 

Static Public Member Functions

static bool IsSuperMajority (int minVersion, const CBlockIndex *pstart, unsigned int nRequired)
 Returns true if there are nRequired or more blocks of minVersion or above in the last Params().ToCheckBlockUpgradeMajority() blocks, starting at pstart and going backwards. More...
 

Public Attributes

const uint256phashBlock
 pointer to the hash of the block, if any. memory is owned by this CBlockIndex More...
 
CBlockIndexpprev
 pointer to the index of the predecessor of this block More...
 
CBlockIndexpnext
 pointer to the index of the next block More...
 
CBlockIndexpskip
 pointer to the index of some further predecessor of this block More...
 
uint256 bnChainTrust
 
int nHeight
 height of the entry in the chain. The genesis block has height 0 More...
 
int nFile
 Which # file this block is stored in (blk?????.dat) More...
 
unsigned int nDataPos
 Byte offset within blk?????.dat where this block's data is stored. More...
 
unsigned int nUndoPos
 Byte offset within rev?????.dat where this block's undo data is stored. More...
 
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
 Number of transactions in this block. More...
 
unsigned int nChainTx
 (memory only) Number of transactions in the chain up to and including this block. More...
 
unsigned int nStatus
 Verification status of this block. See enum BlockStatus. More...
 
unsigned int nFlags
 
uint64_t nStakeModifier
 
unsigned int nStakeModifierChecksum
 
COutPoint prevoutStake
 
unsigned int nStakeTime
 
uint256 hashProofOfStake
 
int64_t nMint
 
int64_t nMoneySupply
 
int nVersion
 block header More...
 
uint256 hashMerkleRoot
 
unsigned int nTime
 
unsigned int nBits
 
unsigned int nNonce
 
uint256 nAccumulatorCheckpoint
 
uint256 hashPoAMerkleRoot
 PoA block header. More...
 
uint256 minedHash
 
uint256 hashPrevPoABlock
 
uint32_t nSequenceId
 (memory only) Sequential id assigned to distinguish order in which blocks are received. 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 162 of file chain.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
BLOCK_PROOF_OF_STAKE 
BLOCK_STAKE_ENTROPY 
BLOCK_STAKE_MODIFIER 
BLOCK_PROOF_OF_AUDIT 

Definition at line 208 of file chain.h.

◆ anonymous enum

anonymous enum
Enumerator
nMedianTimeSpan 

Definition at line 369 of file chain.h.

Constructor & Destructor Documentation

◆ CBlockIndex() [1/2]

CBlockIndex::CBlockIndex ( )
inline

Definition at line 276 of file chain.h.

Here is the call graph for this function:

◆ CBlockIndex() [2/2]

CBlockIndex::CBlockIndex ( const CBlock block)
inline

Definition at line 281 of file chain.h.

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 4884 of file main.cpp.

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

◆ GeneratedStakeModifier()

bool CBlockIndex::GeneratedStakeModifier ( ) const
inline

Definition at line 426 of file chain.h.

◆ GetAncestor() [1/2]

CBlockIndex * CBlockIndex::GetAncestor ( int  height)

Efficiently find an ancestor of this block.

Definition at line 4856 of file main.cpp.

Here is the caller graph for this function:

◆ GetAncestor() [2/2]

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

Definition at line 4879 of file main.cpp.

Here is the call graph for this function:

◆ GetBlockHash()

uint256 CBlockIndex::GetBlockHash ( ) const
inline

Definition at line 359 of file chain.h.

Here is the caller graph for this function:

◆ GetBlockHeader()

CBlockHeader CBlockIndex::GetBlockHeader ( ) const
inline

Definition at line 340 of file chain.h.

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

◆ GetBlockPos()

CDiskBlockPos CBlockIndex::GetBlockPos ( ) const
inline

Definition at line 320 of file chain.h.

Here is the caller graph for this function:

◆ GetBlockTime()

int64_t CBlockIndex::GetBlockTime ( ) const
inline

Definition at line 364 of file chain.h.

Here is the caller graph for this function:

◆ GetBlockTrust()

uint256 CBlockIndex::GetBlockTrust ( ) const

Definition at line 66 of file chain.cpp.

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

◆ GetMedianTimePast()

int64_t CBlockIndex::GetMedianTimePast ( ) const
inline

Definition at line 371 of file chain.h.

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

◆ GetStakeEntropyBit()

unsigned int CBlockIndex::GetStakeEntropyBit ( ) const
inline

Definition at line 409 of file chain.h.

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

◆ GetUndoPos()

CDiskBlockPos CBlockIndex::GetUndoPos ( ) const
inline

Definition at line 330 of file chain.h.

Here is the caller graph for this function:

◆ IsProofOfAudit()

bool CBlockIndex::IsProofOfAudit ( ) const
inline

Definition at line 400 of file chain.h.

Here is the caller graph for this function:

◆ IsProofOfStake()

bool CBlockIndex::IsProofOfStake ( ) const
inline

Definition at line 390 of file chain.h.

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

◆ IsProofOfWork()

bool CBlockIndex::IsProofOfWork ( ) const
inline

Definition at line 385 of file chain.h.

Here is the call graph for this function:

◆ IsSuperMajority()

bool CBlockIndex::IsSuperMajority ( int  minVersion,
const CBlockIndex pstart,
unsigned int  nRequired 
)
static

Returns true if there are nRequired or more blocks of minVersion or above in the last Params().ToCheckBlockUpgradeMajority() blocks, starting at pstart and going backwards.

Definition at line 4829 of file main.cpp.

Here is the call graph for this function:

◆ IsValid()

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

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

Definition at line 454 of file chain.h.

Here is the caller graph for this function:

◆ RaiseValidity()

bool CBlockIndex::RaiseValidity ( enum BlockStatus  nUpTo)
inline

Raise the validity level of this block index entry.

Returns true if the validity was changed.

Definition at line 464 of file chain.h.

Here is the caller graph for this function:

◆ SetNull()

void CBlockIndex::SetNull ( )
inline

Definition at line 241 of file chain.h.

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

◆ SetProofOfAudit()

void CBlockIndex::SetProofOfAudit ( )
inline

Definition at line 404 of file chain.h.

Here is the caller graph for this function:

◆ SetProofOfStake()

void CBlockIndex::SetProofOfStake ( )
inline

Definition at line 395 of file chain.h.

Here is the caller graph for this function:

◆ SetStakeEntropyBit()

bool CBlockIndex::SetStakeEntropyBit ( unsigned int  nEntropyBit)
inline

Definition at line 418 of file chain.h.

Here is the caller graph for this function:

◆ SetStakeModifier()

void CBlockIndex::SetStakeModifier ( uint64_t  nModifier,
bool  fGeneratedStakeModifier 
)
inline

Definition at line 431 of file chain.h.

Here is the caller graph for this function:

◆ ToString()

std::string CBlockIndex::ToString ( ) const
inline

Definition at line 445 of file chain.h.

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

Member Data Documentation

◆ bnChainTrust

uint256 CBlockIndex::bnChainTrust

Definition at line 178 of file chain.h.

◆ hashMerkleRoot

uint256 CBlockIndex::hashMerkleRoot

Definition at line 227 of file chain.h.

◆ hashPoAMerkleRoot

uint256 CBlockIndex::hashPoAMerkleRoot

PoA block header.

Definition at line 234 of file chain.h.

◆ hashPrevPoABlock

uint256 CBlockIndex::hashPrevPoABlock

Definition at line 236 of file chain.h.

◆ hashProofOfStake

uint256 CBlockIndex::hashProofOfStake

Definition at line 221 of file chain.h.

◆ minedHash

uint256 CBlockIndex::minedHash

Definition at line 235 of file chain.h.

◆ nAccumulatorCheckpoint

uint256 CBlockIndex::nAccumulatorCheckpoint

Definition at line 231 of file chain.h.

◆ nBits

unsigned int CBlockIndex::nBits

Definition at line 229 of file chain.h.

◆ nChainTx

unsigned int CBlockIndex::nChainTx

(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 202 of file chain.h.

◆ nChainWork

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 193 of file chain.h.

◆ nDataPos

unsigned int CBlockIndex::nDataPos

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

Definition at line 187 of file chain.h.

◆ nFile

int CBlockIndex::nFile

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

Definition at line 184 of file chain.h.

◆ nFlags

unsigned int CBlockIndex::nFlags

Definition at line 207 of file chain.h.

◆ nHeight

int CBlockIndex::nHeight

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

Definition at line 181 of file chain.h.

◆ nMint

int64_t CBlockIndex::nMint

Definition at line 222 of file chain.h.

◆ nMoneySupply

int64_t CBlockIndex::nMoneySupply

Definition at line 223 of file chain.h.

◆ nNonce

unsigned int CBlockIndex::nNonce

Definition at line 230 of file chain.h.

◆ nSequenceId

uint32_t CBlockIndex::nSequenceId

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

Definition at line 239 of file chain.h.

◆ nStakeModifier

uint64_t CBlockIndex::nStakeModifier

Definition at line 217 of file chain.h.

◆ nStakeModifierChecksum

unsigned int CBlockIndex::nStakeModifierChecksum

Definition at line 218 of file chain.h.

◆ nStakeTime

unsigned int CBlockIndex::nStakeTime

Definition at line 220 of file chain.h.

◆ nStatus

unsigned int CBlockIndex::nStatus

Verification status of this block. See enum BlockStatus.

Definition at line 205 of file chain.h.

◆ nTime

unsigned int CBlockIndex::nTime

Definition at line 228 of file chain.h.

◆ nTx

unsigned int CBlockIndex::nTx

Number of transactions in this block.

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

Definition at line 197 of file chain.h.

◆ nUndoPos

unsigned int CBlockIndex::nUndoPos

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

Definition at line 190 of file chain.h.

◆ nVersion

int CBlockIndex::nVersion

block header

Definition at line 226 of file chain.h.

◆ phashBlock

const uint256* CBlockIndex::phashBlock

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

Definition at line 166 of file chain.h.

◆ pnext

CBlockIndex* CBlockIndex::pnext

pointer to the index of the next block

Definition at line 172 of file chain.h.

◆ pprev

CBlockIndex* CBlockIndex::pprev

pointer to the index of the predecessor of this block

Definition at line 169 of file chain.h.

◆ prevoutStake

COutPoint CBlockIndex::prevoutStake

Definition at line 219 of file chain.h.

◆ pskip

CBlockIndex* CBlockIndex::pskip

pointer to the index of some further predecessor of this block

Definition at line 175 of file chain.h.


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