Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,622 Lines • ▼ Show 20 Lines | static UniValue getchaintips(const Config &config, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
/** | /** | ||||
* Idea: the set of chain tips is ::ChainActive().tip, plus orphan blocks | * Idea: the set of chain tips is ::ChainActive().tip, plus orphan blocks | ||||
* which do not have another orphan building off of them. Algorithm: | * which do not have another orphan building off of them. Algorithm: | ||||
* - Make one pass through g_blockman.m_block_index, picking out the orphan | * - Make one pass through BlockIndex(), picking out the orphan | ||||
* blocks, and also storing a set of the orphan block's pprev pointers. | * blocks, and also storing a set of the orphan block's pprev pointers. | ||||
* - Iterate through the orphan blocks. If the block isn't pointed to by | * - Iterate through the orphan blocks. If the block isn't pointed to by | ||||
* another orphan, it is a chain tip. | * another orphan, it is a chain tip. | ||||
* - add ::ChainActive().Tip() | * - add ::ChainActive().Tip() | ||||
*/ | */ | ||||
std::set<const CBlockIndex *, CompareBlocksByHeight> setTips; | std::set<const CBlockIndex *, CompareBlocksByHeight> setTips; | ||||
std::set<const CBlockIndex *> setOrphans; | std::set<const CBlockIndex *> setOrphans; | ||||
std::set<const CBlockIndex *> setPrevs; | std::set<const CBlockIndex *> setPrevs; | ||||
▲ Show 20 Lines • Show All 1,314 Lines • Show Last 20 Lines |