Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Private Attributes | Friends | List of all members
CChain Class Reference

An in-memory indexed chain of blocks. More...

#include <main.h>

Public Member Functions

CBlockIndexGenesis () const
 Returns the index entry for the genesis block of this chain, or NULL if none. More...
 
CBlockIndexTip () const
 Returns the index entry for the tip of this chain, or NULL if none. More...
 
CBlockIndexoperator[] (int nHeight) const
 Returns the index entry at a particular height in this chain, or NULL if no such height exists. More...
 
bool Contains (const CBlockIndex *pindex) const
 Efficiently check whether a block is present in this chain. More...
 
CBlockIndexNext (const CBlockIndex *pindex) const
 Find the successor of a block in this chain, or NULL if the given index is not found or is the tip. More...
 
int Height () const
 Return the maximal height in the chain. More...
 
CBlockIndexSetTip (CBlockIndex *pindex)
 Set/initialize a chain with a given tip. More...
 
CBlockLocator GetLocator (const CBlockIndex *pindex=NULL) const
 Return a CBlockLocator that refers to a block in this chain (by default the tip). More...
 
CBlockIndexFindFork (const CBlockLocator &locator) const
 Find the last common block between this chain and a locator. More...
 

Private Attributes

std::vector< CBlockIndex * > vChain
 

Friends

bool operator== (const CChain &a, const CChain &b)
 Compare two chains efficiently. More...
 

Detailed Description

An in-memory indexed chain of blocks.

Definition at line 1013 of file main.h.

Member Function Documentation

bool CChain::Contains ( const CBlockIndex pindex) const
inline

Efficiently check whether a block is present in this chain.

Definition at line 1042 of file main.h.

Here is the caller graph for this function:

CBlockIndex * CChain::FindFork ( const CBlockLocator locator) const

Find the last common block between this chain and a locator.

Definition at line 422 of file main.cpp.

Here is the caller graph for this function:

CBlockIndex* CChain::Genesis ( ) const
inline

Returns the index entry for the genesis block of this chain, or NULL if none.

Definition at line 1019 of file main.h.

Here is the caller graph for this function:

CBlockLocator CChain::GetLocator ( const CBlockIndex pindex = NULL) const

Return a CBlockLocator that refers to a block in this chain (by default the tip).

Definition at line 395 of file main.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int CChain::Height ( ) const
inline

Return the maximal height in the chain.

Is equal to chain.Tip() ? chain.Tip()->nHeight : -1.

Definition at line 1055 of file main.h.

Here is the caller graph for this function:

CBlockIndex* CChain::Next ( const CBlockIndex pindex) const
inline

Find the successor of a block in this chain, or NULL if the given index is not found or is the tip.

Definition at line 1047 of file main.h.

Here is the call graph for this function:

Here is the caller graph for this function:

CBlockIndex* CChain::operator[] ( int  nHeight) const
inline

Returns the index entry at a particular height in this chain, or NULL if no such height exists.

Definition at line 1029 of file main.h.

CBlockIndex * CChain::SetTip ( CBlockIndex pindex)

Set/initialize a chain with a given tip.

Returns the forking point.

Definition at line 382 of file main.cpp.

Here is the caller graph for this function:

CBlockIndex* CChain::Tip ( ) const
inline

Returns the index entry for the tip of this chain, or NULL if none.

Definition at line 1024 of file main.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

bool operator== ( const CChain a,
const CChain b 
)
friend

Compare two chains efficiently.

Definition at line 1036 of file main.h.

Member Data Documentation

std::vector<CBlockIndex*> CChain::vChain
private

Definition at line 1015 of file main.h.


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