Skip to content

Commit 3bbb6fe

Browse files
committed
style-only: Various blockstorage.cpp cleanups
1 parent 5be9ee3 commit 3bbb6fe

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/node/blockstorage.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
203203
return nullptr;
204204
}
205205

206-
// Return existing or create new
207-
auto [mi, inserted] = m_block_index.try_emplace(hash);
206+
const auto [mi, inserted]{m_block_index.try_emplace(hash)};
208207
CBlockIndex* pindex = &(*mi).second;
209208
if (inserted) {
210209
pindex->phashBlock = &((*mi).first);
@@ -224,8 +223,7 @@ bool BlockManager::LoadBlockIndex(
224223
std::vector<std::pair<int, CBlockIndex*>> vSortedByHeight;
225224
vSortedByHeight.reserve(m_block_index.size());
226225
for (auto& [_, block_index] : m_block_index) {
227-
CBlockIndex* pindex = &block_index;
228-
vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex));
226+
vSortedByHeight.push_back(std::make_pair(block_index.nHeight, &block_index));
229227
}
230228
sort(vSortedByHeight.begin(), vSortedByHeight.end());
231229

@@ -382,9 +380,8 @@ bool BlockManager::LoadBlockIndexDB(ChainstateManager& chainman)
382380
LogPrintf("Checking all blk files are present...\n");
383381
std::set<int> setBlkDataFiles;
384382
for (const auto& [_, block_index] : m_block_index) {
385-
const CBlockIndex* pindex = &block_index;
386-
if (pindex->nStatus & BLOCK_HAVE_DATA) {
387-
setBlkDataFiles.insert(pindex->nFile);
383+
if (block_index.nStatus & BLOCK_HAVE_DATA) {
384+
setBlkDataFiles.insert(block_index.nFile);
388385
}
389386
}
390387
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) {

0 commit comments

Comments
 (0)