![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
An in-memory indexed chain of blocks. More...
#include <main.h>
Collaboration diagram for CChain:Public Member Functions | |
| CBlockIndex * | Genesis () const |
| Returns the index entry for the genesis block of this chain, or NULL if none. More... | |
| CBlockIndex * | Tip () const |
| Returns the index entry for the tip of this chain, or NULL if none. More... | |
| CBlockIndex * | operator[] (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... | |
| CBlockIndex * | Next (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... | |
| CBlockIndex * | SetTip (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... | |
| CBlockIndex * | FindFork (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... | |
|
inline |
Efficiently check whether a block is present in this chain.
Definition at line 1030 of file main.h.
References CBlockIndex::nHeight.
Referenced by ActivateBestChain(), FindMostWorkChain(), CMerkleTx::GetDepthInMainChainINTERNAL(), CWallet::GetKeyBirthTimes(), load_most_relevant_state(), Next(), ProcessGetData(), and TxToJSON().
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 399 of file main.cpp.
References CBlockLocator::vHave.
Referenced by AppInit2(), and ProcessMessage().
Here is the caller graph for this function:
|
inline |
Returns the index entry for the genesis block of this chain, or NULL if none.
Definition at line 1007 of file main.h.
Referenced by AppInit2(), importprivkey(), InitBlockIndex(), and PrintBlockTree().
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 372 of file main.cpp.
References CBlockIndex::GetBlockHash(), CBlockIndex::nHeight, and CBlockIndex::pprev.
Referenced by AppInit2(), PushGetBlocks(), Shutdown(), and UpdateTip().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Return the maximal height in the chain.
Is equal to chain.Tip() ? chain.Tip()->nHeight : -1.
Definition at line 1043 of file main.h.
Referenced by AcceptBlock(), AcceptToMemoryPool(), ActivateBestChain(), AppInit2(), mastercore::checkExpiredAlerts(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), dumpwallet(), TransactionDesc::FormatTxStatus(), getblockchaininfo(), getblockcount(), getblockhash(), CMerkleTx::GetDepthInMainChainINTERNAL(), mastercore::GetHeight(), getinfo(), getinfo_MP(), CWallet::GetKeyBirthTimes(), getmininginfo(), GetNetworkHashPS(), ClientModel::getNumBlocks(), getrawmempool(), importwallet(), InvalidChainFound(), IsFinalTx(), IsInitialBlockDownload(), IsStandardTx(), listsinceblock(), LoadBlockIndexDB(), WalletModel::pollBalanceChanged(), CMPTxList::setLastAlert(), TransactionRecord::statusUpdateNeeded(), TxToJSON(), TransactionRecord::updateStatus(), UpdateTip(), and VerifyDB().
Here is the caller graph for this function:
|
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 1035 of file main.h.
References Contains(), and CBlockIndex::nHeight.
Referenced by blockToJSON(), CBlockIndex::GetMedianTime(), PrintBlockTree(), ProcessMessage(), CWallet::ScanForWalletTransactions(), and VerifyDB().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
| CBlockIndex * CChain::SetTip | ( | CBlockIndex * | pindex | ) |
Set/initialize a chain with a given tip.
Returns the forking point.
Definition at line 359 of file main.cpp.
References CBlockIndex::nHeight, and CBlockIndex::pprev.
Referenced by FindMostWorkChain(), LoadBlockIndexDB(), UnloadBlockIndex(), and UpdateTip().
Here is the caller graph for this function:
|
inline |
Returns the index entry for the tip of this chain, or NULL if none.
Definition at line 1012 of file main.h.
Referenced by AcceptBlock(), ActivateBestChain(), AddToBlockIndex(), AppInit2(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), ConnectTip(), CreateNewBlock(), DisconnectTip(), dumpwallet(), FindMostWorkChain(), getbestblockhash(), getblockchaininfo(), getblocktemplate(), GetDifficulty(), ClientModel::getLastBlockDate(), mastercore::GetLatestBlockTime(), GetNetworkHashPS(), ClientModel::getVerificationProgress(), importwallet(), InvalidChainFound(), IsInitialBlockDownload(), LoadBlockIndexDB(), ProcessBlock(), ProcessGetData(), ProcessMessage(), CWallet::ScanForWalletTransactions(), SendMessages(), UpdateTip(), and VerifyDB().
Here is the caller graph for this function:
|
private |
1.8.8