aboutsummaryrefslogtreecommitdiff
path: root/src/node/blockstorage.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-03-03 15:05:15 -0500
committerCarl Dong <contact@carldong.me>2022-03-09 14:32:49 -0500
commit3bbb6fea051f4e19bd2448e401a6c4e9b4cc7a41 (patch)
tree764fd6302de608f1d7c6ea76ca1d2bb899241b3d /src/node/blockstorage.cpp
parent5be9ee3c54dcb396ff52fc8c8b7e4e6e39ec4a3b (diff)
downloadbitcoin-3bbb6fea051f4e19bd2448e401a6c4e9b4cc7a41.tar.xz
style-only: Various blockstorage.cpp cleanups
Diffstat (limited to 'src/node/blockstorage.cpp')
-rw-r--r--src/node/blockstorage.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index c35d2a51ce..f948a6cbd7 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -203,8 +203,7 @@ CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
return nullptr;
}
- // Return existing or create new
- auto [mi, inserted] = m_block_index.try_emplace(hash);
+ const auto [mi, inserted]{m_block_index.try_emplace(hash)};
CBlockIndex* pindex = &(*mi).second;
if (inserted) {
pindex->phashBlock = &((*mi).first);
@@ -224,8 +223,7 @@ bool BlockManager::LoadBlockIndex(
std::vector<std::pair<int, CBlockIndex*>> vSortedByHeight;
vSortedByHeight.reserve(m_block_index.size());
for (auto& [_, block_index] : m_block_index) {
- CBlockIndex* pindex = &block_index;
- vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex));
+ vSortedByHeight.push_back(std::make_pair(block_index.nHeight, &block_index));
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
@@ -382,9 +380,8 @@ bool BlockManager::LoadBlockIndexDB(ChainstateManager& chainman)
LogPrintf("Checking all blk files are present...\n");
std::set<int> setBlkDataFiles;
for (const auto& [_, block_index] : m_block_index) {
- const CBlockIndex* pindex = &block_index;
- if (pindex->nStatus & BLOCK_HAVE_DATA) {
- setBlkDataFiles.insert(pindex->nFile);
+ if (block_index.nStatus & BLOCK_HAVE_DATA) {
+ setBlkDataFiles.insert(block_index.nFile);
}
}
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) {