Dash Core  0.12.2.1
P2P Digital Currency
CChain Class Reference

#include <chain.h>

Public Member Functions

CBlockIndexGenesis () const
 
CBlockIndexTip () const
 
CBlockIndexoperator[] (int nHeight) const
 
bool Contains (const CBlockIndex *pindex) const
 
CBlockIndexNext (const CBlockIndex *pindex) const
 
int Height () const
 
void SetTip (CBlockIndex *pindex)
 
CBlockLocator GetLocator (const CBlockIndex *pindex=NULL) const
 
const CBlockIndexFindFork (const CBlockIndex *pindex) const
 

Private Attributes

std::vector< CBlockIndex * > vChain
 

Friends

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

Detailed Description

An in-memory indexed chain of blocks.

Definition at line 355 of file chain.h.

Member Function Documentation

◆ Contains()

◆ FindFork()

const CBlockIndex * CChain::FindFork ( const CBlockIndex pindex) const

Find the last common block between this chain and a block index entry.

Definition at line 53 of file chain.cpp.

Referenced by ActivateBestChain(), ActivateBestChainStep(), and getchaintips().

◆ Genesis()

CBlockIndex* CChain::Genesis ( ) const
inline

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

Definition at line 361 of file chain.h.

Referenced by AppInit2(), CheckBlockIndex(), FindForkInGlobalIndex(), importaddress(), importprivkey(), importpubkey(), and InitBlockIndex().

◆ GetLocator()

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 25 of file chain.cpp.

Referenced by AppInit2(), FlushStateToDisk(), ProcessMessage(), and SendMessages().

◆ Height()

◆ Next()

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

Referenced by blockheaderToJSON(), blockToJSON(), getblockheaders(), ProcessMessage(), rest_headers(), CWallet::ScanForWalletTransactions(), and CVerifyDB::VerifyDB().

◆ operator[]()

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

◆ SetTip()

void CChain::SetTip ( CBlockIndex pindex)

Set/initialize a chain with a given tip.

CChain implementation

Definition at line 13 of file chain.cpp.

Referenced by LoadBlockIndexDB(), UnloadBlockIndex(), and UpdateTip().

◆ Tip()

Friends And Related Function Documentation

◆ operator==

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

Compare two chains efficiently.

Definition at line 378 of file chain.h.

Member Data Documentation

◆ vChain

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

Definition at line 357 of file chain.h.

Referenced by Genesis(), Height(), operator[](), and Tip().


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