Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
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>
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 uint256 * | phashBlock |
CBlockIndex * | pprev |
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 |
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.
|
inline |
Definition at line 753 of file main.h.
References CBlockHeader::hashMerkleRoot, CBlockHeader::nBits, CBlockHeader::nNonce, CBlockHeader::nTime, and CBlockHeader::nVersion.
|
inline |
Definition at line 824 of file main.h.
References CheckProofOfWork(), and GetBlockHash().
Referenced by CBlockTreeDB::LoadBlockIndexGuts().
|
inline |
Definition at line 805 of file main.h.
References phashBlock.
Referenced by AcceptBlock(), ActivateBestChain(), blockToJSON(), CDiskBlockIndex::CDiskBlockIndex(), CheckIndex(), ConnectBlock(), ConnectTip(), CreateNewBlock(), DisconnectBlock(), DisconnectTip(), dumpwallet(), mastercore::eraseExpiredCrowdsale(), getbestblockhash(), getblockchaininfo(), getblockhash(), GetBlockHeader(), CChain::GetLocator(), GetTransaction(), gettxout(), InvalidBlockFound(), InvalidChainFound(), listsinceblock(), load_most_relevant_state(), LoadBlockIndexDB(), msc_initial_scan(), ProcessBlock(), ProcessGetData(), ProcessMessage(), ReadBlockFromDisk(), ToString(), CDiskBlockIndex::ToString(), UpdateTip(), VerifyDB(), write_state_file(), and CBlockTreeDB::WriteBlockIndex().
|
inline |
Definition at line 792 of file main.h.
References GetBlockHash(), CBlockHeader::hashMerkleRoot, hashMerkleRoot, CBlockHeader::hashPrevBlock, CBlockHeader::nBits, nBits, CBlockHeader::nNonce, nNonce, CBlockHeader::nTime, nTime, CBlockHeader::nVersion, and nVersion.
Referenced by ProcessMessage().
|
inline |
Definition at line 774 of file main.h.
References BLOCK_HAVE_DATA, nDataPos, CDiskBlockPos::nFile, nFile, and CDiskBlockPos::nPos.
Referenced by ConnectBlock(), PrintBlockTree(), and ReadBlockFromDisk().
|
inline |
Definition at line 810 of file main.h.
References nTime.
Referenced by mastercore::eraseExpiredCrowdsale(), CMPMetaDEx::getBlockTime(), ClientModel::getLastBlockDate(), mastercore::GetLatestBlockTime(), GetMedianTimePast(), GetNetworkHashPS(), GetNextWorkRequired(), InvalidChainFound(), IsInitialBlockDownload(), LoadBlockIndexDB(), mastercore_handler_block_end(), mastercore_handler_tx(), CMPTxList::setLastAlert(), and UpdateTip().
|
inline |
Definition at line 815 of file main.h.
References CBigNum::SetCompact().
Referenced by AddToBlockIndex(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), and LoadBlockIndexDB().
int64_t CBlockIndex::GetMedianTime | ( | ) | const |
Definition at line 2517 of file main.cpp.
References AssertLockHeld, GetMedianTimePast(), and CChain::Next().
|
inline |
Definition at line 831 of file main.h.
References GetBlockTime(), nMedianTimeSpan, and pprev.
Referenced by AcceptBlock(), getblocktemplate(), GetMedianTime(), and UpdateTime().
|
inline |
Definition at line 783 of file main.h.
References BLOCK_HAVE_UNDO, CDiskBlockPos::nFile, nFile, CDiskBlockPos::nPos, and nUndoPos.
Referenced by ConnectBlock(), DisconnectBlock(), and VerifyDB().
|
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 2505 of file main.cpp.
References nVersion, and pprev.
Referenced by AcceptBlock().
|
inline |
Definition at line 862 of file main.h.
References LogPrintf, and ToString().
|
inline |
Definition at line 854 of file main.h.
References GetBlockHash(), strprintf, and base_uint< BITS >::ToString().
Referenced by CBlockTreeDB::LoadBlockIndexGuts(), print(), prune_state_files(), and CDiskBlockIndex::ToString().
uint256 CBlockIndex::hashMerkleRoot |
Definition at line 724 of file main.h.
Referenced by GetBlockHeader(), CMerkleTx::GetDepthInMainChainINTERNAL(), and CBlockTreeDB::LoadBlockIndexGuts().
unsigned int CBlockIndex::nBits |
Definition at line 726 of file main.h.
Referenced by GetBlockHeader(), GetDifficulty(), GetNextWorkRequired(), CBlockTreeDB::LoadBlockIndexGuts(), and ProcessBlock().
unsigned int CBlockIndex::nChainTx |
Definition at line 717 of file main.h.
Referenced by AddToBlockIndex(), Checkpoints::GuessVerificationProgress(), LoadBlockIndexDB(), and UpdateTip().
uint256 CBlockIndex::nChainWork |
Definition at line 710 of file main.h.
Referenced by AddToBlockIndex(), blockToJSON(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), FindMostWorkChain(), getblockchaininfo(), GetNetworkHashPS(), InvalidChainFound(), LoadBlockIndexDB(), and UpdateTip().
unsigned int CBlockIndex::nDataPos |
Definition at line 704 of file main.h.
Referenced by AddToBlockIndex(), GetBlockPos(), and CBlockTreeDB::LoadBlockIndexGuts().
int CBlockIndex::nFile |
Definition at line 701 of file main.h.
Referenced by AddToBlockIndex(), ConnectBlock(), GetBlockPos(), GetUndoPos(), and CBlockTreeDB::LoadBlockIndexGuts().
int CBlockIndex::nHeight |
Definition at line 698 of file main.h.
Referenced by AcceptBlock(), AddToBlockIndex(), AppInit2(), blockToJSON(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CheckInputs(), ConnectBlock(), CChain::Contains(), CreateNewBlock(), DisconnectBlock(), getblocktemplate(), CMerkleTx::GetDepthInMainChainINTERNAL(), CChain::GetLocator(), GetNetworkHashPS(), GetNextWorkRequired(), gettxout(), importwallet(), IncrementExtraNonce(), InvalidChainFound(), listsinceblock(), listtransactions_MP(), load_most_relevant_state(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), mastercore_handler_block_begin(), mastercore_handler_disc_begin(), CChain::Next(), populateRPCTransactionObject(), PrintBlockTree(), ProcessMessage(), prune_state_files(), CWallet::ScanForWalletTransactions(), CChain::SetTip(), TxToJSON(), TransactionRecord::updateStatus(), and VerifyDB().
unsigned int CBlockIndex::nNonce |
Definition at line 727 of file main.h.
Referenced by GetBlockHeader(), and CBlockTreeDB::LoadBlockIndexGuts().
uint32_t CBlockIndex::nSequenceId |
Definition at line 730 of file main.h.
Referenced by AddToBlockIndex().
unsigned int CBlockIndex::nStatus |
Definition at line 720 of file main.h.
Referenced by AddToBlockIndex(), ConnectBlock(), FindMostWorkChain(), InvalidBlockFound(), LoadBlockIndexDB(), and CBlockTreeDB::LoadBlockIndexGuts().
unsigned int CBlockIndex::nTime |
Definition at line 725 of file main.h.
Referenced by ConnectBlock(), dumpwallet(), GetBlockHeader(), GetBlockTime(), GetNextWorkRequired(), Checkpoints::GuessVerificationProgress(), importwallet(), CBlockTreeDB::LoadBlockIndexGuts(), ProcessBlock(), CWallet::ScanForWalletTransactions(), and TxToJSON().
unsigned int CBlockIndex::nTx |
Definition at line 714 of file main.h.
Referenced by AddToBlockIndex(), LoadBlockIndexDB(), and CBlockTreeDB::LoadBlockIndexGuts().
unsigned int CBlockIndex::nUndoPos |
Definition at line 707 of file main.h.
Referenced by AddToBlockIndex(), ConnectBlock(), GetUndoPos(), and CBlockTreeDB::LoadBlockIndexGuts().
int CBlockIndex::nVersion |
Definition at line 723 of file main.h.
Referenced by GetBlockHeader(), IsSuperMajority(), CBlockTreeDB::LoadBlockIndexGuts(), and UpdateTip().
const uint256* CBlockIndex::phashBlock |
Definition at line 692 of file main.h.
Referenced by AddToBlockIndex(), CheckForkWarningConditions(), ConnectBlock(), GetBlockHash(), load_most_relevant_state(), and mastercore_save_state().
CBlockIndex* CBlockIndex::pprev |
Definition at line 695 of file main.h.
Referenced by AddToBlockIndex(), blockToJSON(), CDiskBlockIndex::CDiskBlockIndex(), CheckForkWarningConditionsOnNewFork(), ConnectBlock(), ConnectTip(), CreateNewBlock(), DisconnectBlock(), DisconnectTip(), FindMostWorkChain(), CChain::GetLocator(), GetMedianTimePast(), GetNetworkHashPS(), GetNextWorkRequired(), importwallet(), IsSuperMajority(), load_most_relevant_state(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), PrintBlockTree(), CChain::SetTip(), UpdateTip(), and VerifyDB().