Anoncoin  0.9.4
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 <main.h>

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

Public Types

enum  { nMedianTimeSpan =11 }
 

Public Member Functions

 CBlockIndex ()
 
 CBlockIndex (CBlockHeader &block)
 
CDiskBlockPos GetBlockPos () const
 
CDiskBlockPos GetUndoPos () const
 
CBlockHeader GetBlockHeader () const
 
uint256 GetBlockHash () const
 
int64_t GetBlockTime () const
 
CBigNum GetBlockWork () const
 
bool CheckIndex () const
 
int64_t GetMedianTimePast () const
 
int64_t GetMedianTime () const
 
std::string ToString () const
 
void print () const
 

Static Public Member Functions

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

Public Attributes

const uint256phashBlock
 
CBlockIndexpprev
 
int nHeight
 
int nFile
 
unsigned int nDataPos
 
unsigned int nUndoPos
 
uint256 nChainWork
 
unsigned int nTx
 
unsigned int nChainTx
 
unsigned int nStatus
 
int nVersion
 
uint256 hashMerkleRoot
 
unsigned int nTime
 
unsigned int nBits
 
unsigned int nNonce
 
uint32_t nSequenceId
 

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 698 of file main.h.

Member Enumeration Documentation

anonymous enum
Enumerator
nMedianTimeSpan 

Definition at line 841 of file main.h.

Constructor & Destructor Documentation

CBlockIndex::CBlockIndex ( )
inline

Definition at line 742 of file main.h.

CBlockIndex::CBlockIndex ( CBlockHeader block)
inline

Definition at line 763 of file main.h.

Member Function Documentation

bool CBlockIndex::CheckIndex ( ) const
inline

Scrypt is used for block proof-of-work, but for purposes of performance the index internally uses sha256. This check was considered unneccessary given the other safeguards like the genesis and checkpoints.

Definition at line 834 of file main.h.

Here is the caller graph for this function:

uint256 CBlockIndex::GetBlockHash ( ) const
inline

Definition at line 815 of file main.h.

Here is the caller graph for this function:

CBlockHeader CBlockIndex::GetBlockHeader ( ) const
inline

Definition at line 802 of file main.h.

Here is the call graph for this function:

CDiskBlockPos CBlockIndex::GetBlockPos ( ) const
inline

Definition at line 784 of file main.h.

Here is the caller graph for this function:

int64_t CBlockIndex::GetBlockTime ( ) const
inline

Definition at line 820 of file main.h.

Here is the caller graph for this function:

CBigNum CBlockIndex::GetBlockWork ( ) const
inline

Definition at line 825 of file main.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t CBlockIndex::GetMedianTime ( ) const

Definition at line 2406 of file main.cpp.

Here is the call graph for this function:

int64_t CBlockIndex::GetMedianTimePast ( ) const
inline

Definition at line 843 of file main.h.

Here is the call graph for this function:

Here is the caller graph for this function:

CDiskBlockPos CBlockIndex::GetUndoPos ( ) const
inline

Definition at line 793 of file main.h.

Here is the caller graph for this function:

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

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

Definition at line 2394 of file main.cpp.

void CBlockIndex::print ( ) const
inline

Definition at line 874 of file main.h.

Here is the call graph for this function:

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

Definition at line 866 of file main.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

uint256 CBlockIndex::hashMerkleRoot

Definition at line 734 of file main.h.

unsigned int CBlockIndex::nBits

Definition at line 736 of file main.h.

unsigned int CBlockIndex::nChainTx

Definition at line 727 of file main.h.

uint256 CBlockIndex::nChainWork

Definition at line 720 of file main.h.

unsigned int CBlockIndex::nDataPos

Definition at line 714 of file main.h.

int CBlockIndex::nFile

Definition at line 711 of file main.h.

int CBlockIndex::nHeight

Definition at line 708 of file main.h.

unsigned int CBlockIndex::nNonce

Definition at line 737 of file main.h.

uint32_t CBlockIndex::nSequenceId

Definition at line 740 of file main.h.

unsigned int CBlockIndex::nStatus

Definition at line 730 of file main.h.

unsigned int CBlockIndex::nTime

Definition at line 735 of file main.h.

unsigned int CBlockIndex::nTx

Definition at line 724 of file main.h.

unsigned int CBlockIndex::nUndoPos

Definition at line 717 of file main.h.

int CBlockIndex::nVersion

Definition at line 733 of file main.h.

const uint256* CBlockIndex::phashBlock

Definition at line 702 of file main.h.

CBlockIndex* CBlockIndex::pprev

Definition at line 705 of file main.h.


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