Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 4,466 Lines • ▼ Show 20 Lines | bool CChainState::LoadBlockIndex(const Config &config, | ||||
if (!blocktree.LoadBlockIndexGuts( | if (!blocktree.LoadBlockIndexGuts( | ||||
config.GetChainParams().GetConsensus(), | config.GetChainParams().GetConsensus(), | ||||
[this](const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | [this](const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
return this->InsertBlockIndex(hash); | return this->InsertBlockIndex(hash); | ||||
})) { | })) { | ||||
return false; | return false; | ||||
} | } | ||||
boost::this_thread::interruption_point(); | |||||
// Calculate nChainWork | // Calculate nChainWork | ||||
std::vector<std::pair<int, CBlockIndex *>> vSortedByHeight; | std::vector<std::pair<int, CBlockIndex *>> vSortedByHeight; | ||||
vSortedByHeight.reserve(mapBlockIndex.size()); | vSortedByHeight.reserve(mapBlockIndex.size()); | ||||
for (const std::pair<const BlockHash, CBlockIndex *> &item : | for (const std::pair<const BlockHash, CBlockIndex *> &item : | ||||
mapBlockIndex) { | mapBlockIndex) { | ||||
CBlockIndex *pindex = item.second; | CBlockIndex *pindex = item.second; | ||||
vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex)); | vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,308 Lines • Show Last 20 Lines |