Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
An in-memory indexed chain of blocks. More...
#include <chain.h>
Public Member Functions | |
CBlockIndex * | Genesis () const |
Returns the index entry for the genesis block of this chain, or nullptr if none. More... | |
CBlockIndex * | Tip () const |
Returns the index entry for the tip of this chain, or nullptr if none. More... | |
CBlockIndex * | operator[] (int nHeight) const |
Returns the index entry at a particular height in this chain, or nullptr 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 nullptr if the given index is not found or is the tip. More... | |
int | Height () const |
Return the maximal height in the chain. More... | |
void | SetTip (CBlockIndex *pindex) |
Set/initialize a chain with a given tip. More... | |
CBlockLocator | GetLocator (const CBlockIndex *pindex=nullptr) const |
Return a CBlockLocator that refers to a block in this chain (by default the tip). More... | |
const CBlockIndex * | FindFork (const CBlockIndex *pindex) const |
Find the last common block between this chain and a block index entry. More... | |
CBlockIndex * | FindEarliestAtLeast (int64_t nTime) const |
Find the earliest block with timestamp equal or greater than the given. More... | |
Private Attributes | |
std::vector< CBlockIndex * > | vChain |
Friends | |
bool | operator== (const CChain &a, const CChain &b) |
Compare two chains efficiently. More... | |
Detailed Description
Member Function Documentation
◆ Contains()
|
inline |
Efficiently check whether a block is present in this chain.
Definition at line 471 of file chain.h.
References CBlockIndex::nHeight.
Referenced by blockheaderToJSON(), BlockRequestAllowed(), blockToJSON(), BuildSimplifiedMNListDiff(), llmq::CChainLocksHandler::EnforceBestChainLock(), FindFork(), FindForkInGlobalIndex(), CChainState::FindMostWorkChain(), getblockstats(), getchaintips(), getchaintxstats(), CMerkleTx::GetDepthInMainChain(), CWallet::GetKeyBirthTimes(), GetLocator(), getrawtransaction(), importprunedfunds(), CChainState::InvalidateBlock(), CGovernanceObject::IsCollateralValid(), CWallet::MarkConflicted(), Next(), ProcessHeadersMessage(), rest_headers(), CWallet::ScanForWalletTransactions(), TestLockPointValidity(), TxToJSON(), and verifytxoutproof().
◆ FindEarliestAtLeast()
CBlockIndex * CChain::FindEarliestAtLeast | ( | int64_t | nTime | ) | const |
Find the earliest block with timestamp equal or greater than the given.
Definition at line 62 of file chain.cpp.
References vChain.
Referenced by pruneblockchain(), and CWallet::RescanFromTime().
◆ 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 51 of file chain.cpp.
References Contains(), CBlockIndex::GetAncestor(), Height(), CBlockIndex::nHeight, and CBlockIndex::pprev.
Referenced by CChainState::ActivateBestChain(), CChainState::ActivateBestChainStep(), getchaintips(), and listsinceblock().
◆ Genesis()
|
inline |
Returns the index entry for the genesis block of this chain, or nullptr if none.
Definition at line 448 of file chain.h.
References vChain.
Referenced by BuildSimplifiedMNListDiff(), CChainState::CheckBlockIndex(), CreateTransactionTestSetup::CreateTransactionTestSetup(), CWallet::CreateWalletFromFile(), FindForkInGlobalIndex(), ListCoinsTestingSetup::ListCoinsTestingSetup(), and rescanblockchain().
◆ GetLocator()
CBlockLocator CChain::GetLocator | ( | const CBlockIndex * | pindex = nullptr | ) | const |
Return a CBlockLocator that refers to a block in this chain (by default the tip).
Definition at line 23 of file chain.cpp.
References Contains(), CBlockIndex::GetAncestor(), CBlockIndex::GetBlockHash(), CBlockIndex::nHeight, and Tip().
Referenced by PeerLogicValidation::ConsiderEviction(), CWallet::CreateWalletFromFile(), FlushStateToDisk(), ProcessHeadersMessage(), ProcessMessage(), and PeerLogicValidation::SendMessages().
◆ Height()
|
inline |
Return the maximal height in the chain.
Is equal to chain.Tip() ? chain.Tip()->nHeight : -1.
Definition at line 484 of file chain.h.
References vChain.
Referenced by CChainState::AcceptBlock(), AcceptToMemoryPoolWorker(), AppInitMain(), blockheaderToJSON(), blockToJSON(), CChainState::CheckBlockIndex(), llmq::CInstantSendManager::CheckCanLock(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), llmq::CChainLocksHandler::Cleanup(), CWallet::CreateTransaction(), CWallet::CreateWalletFromFile(), dumpwallet(), FindFork(), TransactionDesc::FormatTxStatus(), getblockchaininfo(), getblockcount(), GetBlockHash(), getblockhash(), getblockstats(), getblocktemplate(), CMerkleTx::GetDepthInMainChain(), getgovernanceinfo(), CWallet::GetKeyBirthTimes(), getmininginfo(), GetNetworkHashPS(), ClientModel::getNumBlocks(), GetRequiredPaymentsStrings(), GetUTXOConfirmations(), importelectrumwallet(), InvalidChainFound(), CGovernanceObject::IsCollateralValid(), IsCurrentForFeeEstimation(), listsinceblock(), LoadChainTip(), CWallet::MarkConflicted(), ParseBlock(), WalletModel::pollBalanceChanged(), ProcessGetBlockData(), ProcessMessage(), CSporkManager::ProcessSpork(), protx_list(), pruneblockchain(), quorum_dkgstatus(), llmq::CInstantSendManager::RemoveChainLockConflictingLock(), CWallet::RescanFromTime(), rest_getutxos(), llmq::CSigningManager::SelectQuorumForSigning(), TransactionRecord::statusUpdateNeeded(), TxToJSON(), TransactionRecord::updateStatus(), llmq::CQuorumBlockProcessor::UpgradeDB(), CDeterministicMNManager::UpgradeDBIfNeeded(), and CVerifyDB::VerifyDB().
◆ Next()
|
inline |
Find the successor of a block in this chain, or nullptr if the given index is not found or is the tip.
Definition at line 476 of file chain.h.
References Contains(), and CBlockIndex::nHeight.
Referenced by blockheaderToJSON(), blockToJSON(), CWallet::CreateWalletFromFile(), getblockheaders(), getmerkleblocks(), ProcessMessage(), rest_headers(), CWallet::ScanForWalletTransactions(), llmq::CQuorumBlockProcessor::UpgradeDB(), and CVerifyDB::VerifyDB().
◆ operator[]()
|
inline |
◆ SetTip()
void CChain::SetTip | ( | CBlockIndex * | pindex | ) |
Set/initialize a chain with a given tip.
CChain implementation.
Definition at line 11 of file chain.cpp.
References CBlockIndex::nHeight, CBlockIndex::pprev, and vChain.
Referenced by CChainState::ConnectTip(), CChainState::DisconnectTip(), LoadChainTip(), and UnloadBlockIndex().
◆ Tip()
|
inline |
Returns the index entry for the tip of this chain, or nullptr if none.
Definition at line 453 of file chain.h.
References vChain.
Referenced by CChainState::AcceptBlock(), AcceptToMemoryPoolWorker(), CChainState::ActivateBestChain(), CChainState::ActivateBestChainStep(), ListCoinsTestingSetup::AddTx(), AlreadyHave(), AppInitMain(), CWallet::BlockUntilSyncedToCurrentChain(), BOOST_FIXTURE_TEST_CASE(), llmq::CChainLocksHandler::CheckActiveState(), CChainState::CheckBlockIndex(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CheckSequenceLocks(), llmq::CChainLocksHandler::Cleanup(), CChainState::ConnectTip(), PeerLogicValidation::ConsiderEviction(), BlockAssembler::CreateNewBlock(), CWallet::CreateWalletFromFile(), CChainState::DisconnectTip(), dumpwallet(), llmq::CChainLocksHandler::EnforceBestChainLock(), FindFilesToPrune(), FindFilesToPruneManual(), getbestblockhash(), getblockchaininfo(), GetBlockHash(), getblocktemplate(), getchaintips(), getchaintxstats(), CreateTransactionTestSetup::GetCoins(), GetDifficulty(), ClientModel::getLastBlockDate(), ClientModel::getLastBlockHash(), GetLocator(), GetNetworkHashPS(), GetUTXOConfirmations(), ClientModel::getVerificationProgress(), importmulti(), importwallet(), CDSNotificationInterface::InitializeCurrentBlockTip(), CChainState::InvalidateBlock(), InvalidChainFound(), IsCurrentForFeeEstimation(), IsInitialBlockDownload(), LoadChainTip(), masternode_winners(), CChainState::PreciousBlock(), llmq::CQuorumBlockProcessor::ProcessBlock(), llmq::CQuorumBlockProcessor::ProcessCommitment(), ProcessGetBlockData(), ProcessHeadersMessage(), llmq::CQuorumBlockProcessor::ProcessMessage(), ProcessMessage(), CSporkManager::ProcessSpork(), CChainState::PruneBlockIndexCandidates(), quorum_list(), quorum_memberof(), CChainState::ReceivedBlockTransactions(), rescanblockchain(), CChainState::ResetBlockFailureFlags(), rest_getutxos(), CWallet::ScanForWalletTransactions(), llmq::CQuorumManager::ScanQuorums(), PeerLogicValidation::SendMessages(), TestBlockValidity(), ThreadImport(), llmq::CChainLocksHandler::TrySignChainTip(), UpdateMempoolForReorg(), llmq::CQuorumBlockProcessor::UpgradeDB(), CDeterministicMNManager::UpgradeDBIfNeeded(), CVerifyDB::VerifyDB(), VersionBitsTipState(), VersionBitsTipStateSinceHeight(), and VersionBitsTipStatistics().
Friends And Related Function Documentation
◆ operator==
Member Data Documentation
◆ vChain
|
private |
Definition at line 444 of file chain.h.
Referenced by FindEarliestAtLeast(), Genesis(), Height(), operator[](), SetTip(), and Tip().
The documentation for this class was generated from the following files: