![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <chain.h>
Public Types | |
enum | { nMedianTimeSpan =11 } |
Public Member Functions | |
void | SetNull () |
CBlockIndex () | |
CBlockIndex (const CBlockHeader &block) | |
CDiskBlockPos | GetBlockPos () const |
CDiskBlockPos | GetUndoPos () const |
CBlockHeader | GetBlockHeader () const |
uint256 | GetBlockHash () const |
int64_t | GetBlockTime () const |
int64_t | GetMedianTimePast () const |
std::string | ToString () const |
bool | IsValid (enum BlockStatus nUpTo=BLOCK_VALID_TRANSACTIONS) const |
Check whether this block index entry is valid up to the passed validity level. More... | |
bool | RaiseValidity (enum BlockStatus nUpTo) |
void | BuildSkip () |
Build the skiplist pointer for this entry. More... | |
CBlockIndex * | GetAncestor (int height) |
Efficiently find an ancestor of this block. More... | |
const CBlockIndex * | GetAncestor (int height) const |
Public Attributes | |
const uint256 * | phashBlock |
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex More... | |
CBlockIndex * | pprev |
pointer to the index of the predecessor of this block More... | |
CBlockIndex * | pskip |
pointer to the index of some further predecessor of this block More... | |
int | nHeight |
height of the entry in the chain. The genesis block has height 0 More... | |
int | nFile |
Which # file this block is stored in (blk?????.dat) More... | |
unsigned int | nDataPos |
Byte offset within blk?????.dat where this block's data is stored. More... | |
unsigned int | nUndoPos |
Byte offset within rev?????.dat where this block's undo data is stored. More... | |
arith_uint256 | nChainWork |
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this block More... | |
unsigned int | nTx |
unsigned int | nChainTx |
unsigned int | nStatus |
Verification status of this block. See enum BlockStatus. More... | |
int | nVersion |
block header More... | |
uint256 | hashMerkleRoot |
unsigned int | nTime |
unsigned int | nBits |
unsigned int | nNonce |
uint32_t | nSequenceId |
(memory only) Sequential id assigned to distinguish order in which blocks are received. More... | |
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 |
void CBlockIndex::BuildSkip | ( | ) |
Build the skiplist pointer for this entry.
Definition at line 109 of file chain.cpp.
Referenced by LoadBlockIndexDB().
CBlockIndex * CBlockIndex::GetAncestor | ( | int | height | ) |
Efficiently find an ancestor of this block.
Definition at line 78 of file chain.cpp.
Referenced by ActivateBestChainStep(), CalculateSequenceLocks(), CheckSequenceLocks(), ConnectBlock(), CChain::FindFork(), CChain::GetLocator(), GetNextWorkRequiredBTC(), and AbstractThresholdConditionChecker::GetStateFor().
const CBlockIndex * CBlockIndex::GetAncestor | ( | int | height | ) | const |
|
inline |
Definition at line 218 of file chain.h.
Referenced by ActivateBestChain(), AlreadyHave(), blockheaderToJSON(), BlockNotifyCallback(), blockToJSON(), CDiskBlockIndex::CDiskBlockIndex(), CheckBlockIndex(), ConnectBlock(), ConnectTip(), CreateNewBlock(), DisconnectBlock(), DisconnectTip(), dumpwallet(), getbestblockhash(), getblockchaininfo(), getblockhash(), GetBlockHeader(), getblocktemplate(), CChain::GetLocator(), GetTransaction(), gettxout(), InvalidChainFound(), listsinceblock(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), CZMQPublishHashBlockNotifier::NotifyBlock(), CZMQPublishRawBlockNotifier::NotifyBlock(), ProcessBlockFound(), ProcessGetData(), ProcessMessage(), ReadBlockFromDisk(), CMasternodePayments::RequestLowDataPaymentBlocks(), rest_getutxos(), SendMessages(), ToString(), PeerLogicValidation::UpdatedBlockTip(), CMasternodeSync::UpdatedBlockTip(), UpdateTip(), and CVerifyDB::VerifyDB().
|
inline |
Definition at line 205 of file chain.h.
Referenced by getblockheader(), getblockheaders(), and rest_headers().
|
inline |
Definition at line 187 of file chain.h.
Referenced by ConnectBlock(), and ReadBlockFromDisk().
|
inline |
Definition at line 223 of file chain.h.
Referenced by BlockTipChanged(), CalculateNextWorkRequired(), CMasternodeBroadcast::CheckOutpoint(), ConnectBlock(), DarkGravityWave(), dumpwallet(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), ClientModel::getLastBlockDate(), GetMedianTimePast(), GetNetworkHashPS(), GetNextWorkRequiredBTC(), Checkpoints::GuessVerificationProgress(), importwallet(), InvalidChainFound(), IsInitialBlockDownload(), KimotoGravityWell(), LoadBlockIndexDB(), ProcessGetData(), ProcessMessage(), CWallet::ScanForWalletTransactions(), SendMessages(), TxToJSON(), and UpdateTip().
|
inline |
Definition at line 230 of file chain.h.
Referenced by blockheaderToJSON(), blockToJSON(), CalculateSequenceLocks(), CheckFinalTx(), ContextualCheckBlock(), ContextualCheckBlockHeader(), CreateNewBlock(), EvaluateSequenceLocks(), getblockchaininfo(), getblocktemplate(), AbstractThresholdConditionChecker::GetStateFor(), and UpdateTime().
|
inline |
Definition at line 196 of file chain.h.
Referenced by ConnectBlock(), and DisconnectBlock().
|
inline |
Check whether this block index entry is valid up to the passed validity level.
Definition at line 253 of file chain.h.
Referenced by ConnectBlock(), getblocktemplate(), getchaintips(), LoadBlockIndexDB(), ProcessMessage(), and submitblock().
|
inline |
Raise the validity level of this block index entry. Returns true if the validity was changed.
Definition at line 263 of file chain.h.
Referenced by ConnectBlock(), and ReceivedBlockTransactions().
|
inline |
Definition at line 149 of file chain.h.
Referenced by CBlockIndex().
|
inline |
Definition at line 244 of file chain.h.
Referenced by CBlockTreeDB::LoadBlockIndexGuts(), ReadBlockFromDisk(), and CDiskBlockIndex::ToString().
uint256 CBlockIndex::hashMerkleRoot |
Definition at line 141 of file chain.h.
Referenced by blockheaderToJSON(), CBlockIndex(), CDiskBlockIndex::GetBlockHash(), GetBlockHeader(), CBlockTreeDB::LoadBlockIndexGuts(), CDiskBlockIndex::SerializationOp(), SetNull(), and ToString().
unsigned int CBlockIndex::nBits |
Definition at line 143 of file chain.h.
Referenced by blockheaderToJSON(), CalculateNextWorkRequired(), CBlockIndex(), ConnectBlock(), CreateNewBlock(), DarkGravityWave(), CDiskBlockIndex::GetBlockHash(), GetBlockHeader(), GetBlockProof(), GetDifficulty(), GetNextWorkRequiredBTC(), KimotoGravityWell(), CBlockTreeDB::LoadBlockIndexGuts(), CDiskBlockIndex::SerializationOp(), and SetNull().
unsigned int CBlockIndex::nChainTx |
(memory only) Number of transactions in the chain up to and including this block. This value will be non-zero only if and only if transactions for this block and all its parents are available. Change to 64-bit type when necessary; won't happen before 2030
Definition at line 134 of file chain.h.
Referenced by CheckBlockIndex(), FindMostWorkChain(), getchaintips(), Checkpoints::GuessVerificationProgress(), LoadBlockIndexDB(), ReceivedBlockTransactions(), SetNull(), and UpdateTip().
arith_uint256 CBlockIndex::nChainWork |
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
Definition at line 125 of file chain.h.
Referenced by AcceptBlock(), ActivateBestChainStep(), AddToBlockIndex(), blockheaderToJSON(), blockToJSON(), CheckBlockIndex(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), ConnectBlock(), FindMostWorkChain(), getblockchaininfo(), GetBlockProofEquivalentTime(), getchaintips(), GetNetworkHashPS(), InvalidChainFound(), IsInitialBlockDownload(), LoadBlockIndexDB(), ProcessMessage(), SetNull(), and UpdateTip().
unsigned int CBlockIndex::nDataPos |
Byte offset within blk?????.dat where this block's data is stored.
Definition at line 119 of file chain.h.
Referenced by GetBlockPos(), CBlockTreeDB::LoadBlockIndexGuts(), PruneOneBlockFile(), ReceivedBlockTransactions(), CDiskBlockIndex::SerializationOp(), and SetNull().
int CBlockIndex::nFile |
Which # file this block is stored in (blk?????.dat)
Definition at line 116 of file chain.h.
Referenced by ConnectBlock(), GetBlockPos(), GetUndoPos(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), PruneOneBlockFile(), ReceivedBlockTransactions(), CDiskBlockIndex::SerializationOp(), and SetNull().
int CBlockIndex::nHeight |
height of the entry in the chain. The genesis block has height 0
Definition at line 113 of file chain.h.
Referenced by AcceptBlock(), CMasternodeSync::AcceptedBlockHeader(), ActivateBestChainStep(), AppInit2(), blockheaderToJSON(), BlockTipChanged(), blockToJSON(), CheckBlockIndex(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CheckIndexAgainstCheckpoint(), CMasternodeBroadcast::CheckOutpoint(), CheckSequenceLocks(), ComputeBlockVersion(), ConnectBlock(), ConnectTip(), CChain::Contains(), ContextualCheckBlock(), ContextualCheckBlockHeader(), CreateNewBlock(), DarkGravityWave(), DisconnectBlock(), EvaluateSequenceLocks(), FindFilesToPrune(), CChain::FindFork(), FindMostWorkChain(), getblockchaininfo(), getblocktemplate(), getchaintips(), CMerkleTx::GetDepthInMainChain(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), CChain::GetLocator(), GetNetworkHashPS(), GetNextWorkRequired(), GetNextWorkRequiredBTC(), GetSpendHeight(), AbstractThresholdConditionChecker::GetStateFor(), gettxout(), importwallet(), IncrementExtraNonce(), InvalidateBlock(), InvalidChainFound(), CGovernanceObject::IsCollateralValid(), KimotoGravityWell(), listsinceblock(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), CWallet::MarkConflicted(), masternode(), CChain::Next(), CMasternodeSync::NotifyHeaderTip(), CompareBlocksByHeight::operator()(), ProcessMessage(), ReconsiderBlock(), CMasternodePayments::RequestLowDataPaymentBlocks(), CWallet::ScanForWalletTransactions(), SendMessages(), CDiskBlockIndex::SerializationOp(), CMerkleTx::SetMerkleBranch(), SetNull(), CChain::SetTip(), CInstantSend::SyncTransaction(), CPrivateSend::SyncTransaction(), TestBlockValidity(), ToString(), TxToJSON(), PeerLogicValidation::UpdatedBlockTip(), CMasternodeSync::UpdatedBlockTip(), CInstantSend::UpdatedBlockTip(), CPrivateSendClient::UpdatedBlockTip(), CMasternodePayments::UpdatedBlockTip(), CMasternodeMan::UpdatedBlockTip(), CGovernanceManager::UpdatedBlockTip(), CMasternode::UpdateLastPaid(), TransactionRecord::updateStatus(), and CVerifyDB::VerifyDB().
unsigned int CBlockIndex::nNonce |
Definition at line 144 of file chain.h.
Referenced by blockheaderToJSON(), CBlockIndex(), CDiskBlockIndex::GetBlockHash(), GetBlockHeader(), CBlockTreeDB::LoadBlockIndexGuts(), CDiskBlockIndex::SerializationOp(), and SetNull().
uint32_t CBlockIndex::nSequenceId |
(memory only) Sequential id assigned to distinguish order in which blocks are received.
Definition at line 147 of file chain.h.
Referenced by CheckBlockIndex(), ReceivedBlockTransactions(), and SetNull().
unsigned int CBlockIndex::nStatus |
Verification status of this block. See enum BlockStatus.
Definition at line 137 of file chain.h.
Referenced by AcceptBlock(), AcceptBlockHeader(), AppInit2(), CheckBlockIndex(), ConnectBlock(), FindMostWorkChain(), getblock(), getblockchaininfo(), GetBlockPos(), getblocktemplate(), getchaintips(), GetUndoPos(), InvalidateBlock(), InvalidBlockFound(), IsValid(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), ProcessMessage(), PruneOneBlockFile(), RaiseValidity(), ReceivedBlockTransactions(), ReconsiderBlock(), rest_block(), CDiskBlockIndex::SerializationOp(), SetNull(), and submitblock().
unsigned int CBlockIndex::nTime |
Definition at line 142 of file chain.h.
Referenced by AppInit2(), blockheaderToJSON(), CBlockIndex(), ConnectBlock(), CDiskBlockIndex::GetBlockHash(), GetBlockHeader(), GetBlockTime(), CBlockTreeDB::LoadBlockIndexGuts(), CDiskBlockIndex::SerializationOp(), SetNull(), and CMasternode::UpdateLastPaid().
unsigned int CBlockIndex::nTx |
Number of transactions in this block. Note: in a potential headers-first mode, this number cannot be relied upon
Definition at line 129 of file chain.h.
Referenced by AcceptBlock(), AppInit2(), CheckBlockIndex(), getblock(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), ReceivedBlockTransactions(), rest_block(), CDiskBlockIndex::SerializationOp(), and SetNull().
unsigned int CBlockIndex::nUndoPos |
Byte offset within rev?????.dat where this block's undo data is stored.
Definition at line 122 of file chain.h.
Referenced by ConnectBlock(), GetUndoPos(), CBlockTreeDB::LoadBlockIndexGuts(), PruneOneBlockFile(), ReceivedBlockTransactions(), CDiskBlockIndex::SerializationOp(), and SetNull().
int CBlockIndex::nVersion |
block header
Definition at line 140 of file chain.h.
Referenced by blockheaderToJSON(), CBlockIndex(), WarningBitsConditionChecker::Condition(), CDiskBlockIndex::GetBlockHash(), GetBlockHeader(), IsSuperMajority(), CBlockTreeDB::LoadBlockIndexGuts(), CDiskBlockIndex::SerializationOp(), SetNull(), SoftForkMajorityDesc(), and UpdateTip().
const uint256* CBlockIndex::phashBlock |
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex
Definition at line 104 of file chain.h.
Referenced by CheckForkWarningConditions(), CheckIndexAgainstCheckpoint(), ConnectBlock(), GetBlockHash(), getchaintips(), and SetNull().
CBlockIndex* CBlockIndex::pprev |
pointer to the index of the predecessor of this block
Definition at line 107 of file chain.h.
Referenced by AcceptBlock(), ActivateBestChainStep(), AppInit2(), blockheaderToJSON(), blockToJSON(), CDiskBlockIndex::CDiskBlockIndex(), CheckBlockIndex(), CheckForkWarningConditionsOnNewFork(), CheckSequenceLocks(), WarningBitsConditionChecker::Condition(), ConnectBlock(), ConnectTip(), DarkGravityWave(), DisconnectBlock(), DisconnectTip(), EvaluateSequenceLocks(), CChain::FindFork(), FindMostWorkChain(), GetAncestor(), getblockchaininfo(), GetBlockHeader(), getchaintips(), GetMedianTimePast(), GetNetworkHashPS(), GetNextWorkRequiredBTC(), AbstractThresholdConditionChecker::GetStateFor(), importwallet(), InvalidateBlock(), IsSuperMajority(), KimotoGravityWell(), LoadBlockIndexDB(), CBlockTreeDB::LoadBlockIndexGuts(), ProcessMessage(), PruneOneBlockFile(), ReceivedBlockTransactions(), ReconsiderBlock(), CMasternodePayments::RequestLowDataPaymentBlocks(), SendMessages(), SetNull(), CChain::SetTip(), SoftForkMajorityDesc(), TestBlockValidity(), ToString(), PeerLogicValidation::UpdatedBlockTip(), CMasternode::UpdateLastPaid(), UpdateTip(), and CVerifyDB::VerifyDB().
CBlockIndex* CBlockIndex::pskip |
pointer to the index of some further predecessor of this block
Definition at line 110 of file chain.h.
Referenced by CheckBlockIndex(), GetAncestor(), and SetNull().