aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-01-13 12:44:19 -0500
committerCarl Dong <contact@carldong.me>2022-02-22 11:56:49 -0500
commitc05cf7aa1e1c15089753897a10c14762027d4b99 (patch)
treefb74e86fa99e070f4c20479459be590545d9b3d3 /src/node
parentc2a1655799c5d5dab9b14bd2a6b2d2296efd6964 (diff)
downloadbitcoin-c05cf7aa1e1c15089753897a10c14762027d4b99.tar.xz
style: Modernize range-based loops over m_block_index
Diffstat (limited to 'src/node')
-rw-r--r--src/node/blockstorage.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index 0619af5426..476f0d8148 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -228,8 +228,8 @@ bool BlockManager::LoadBlockIndex(
// Calculate nChainWork
std::vector<std::pair<int, CBlockIndex*>> vSortedByHeight;
vSortedByHeight.reserve(m_block_index.size());
- for (std::pair<const uint256, CBlockIndex>& item : m_block_index) {
- CBlockIndex* pindex = &item.second;
+ for (auto& [_, block_index] : m_block_index) {
+ CBlockIndex* pindex = &block_index;
vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex));
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
@@ -386,8 +386,8 @@ bool BlockManager::LoadBlockIndexDB(ChainstateManager& chainman)
// Check presence of blk files
LogPrintf("Checking all blk files are present...\n");
std::set<int> setBlkDataFiles;
- for (const std::pair<const uint256, CBlockIndex>& item : m_block_index) {
- const CBlockIndex* pindex = &item.second;
+ for (const auto& [_, block_index] : m_block_index) {
+ const CBlockIndex* pindex = &block_index;
if (pindex->nStatus & BLOCK_HAVE_DATA) {
setBlkDataFiles.insert(pindex->nFile);
}