aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-03 13:06:03 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-03-15 15:47:48 +0100
commitfa442b137764e0b6c0d991ba641e90c3217be1bf (patch)
treea2be20b67dac4d801a98fe472a680c3219bceb8f
parentfa177d7b6b3ad008d442ff9622c9b30e68d6e388 (diff)
Pass fImporting to ImportingNow helper class
-rw-r--r--src/node/blockstorage.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index 4d2d5daf05..46c306fc37 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -844,17 +844,20 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
return blockPos;
}
-struct CImportingNow {
- CImportingNow()
+class ImportingNow
+{
+ std::atomic<bool>& m_importing;
+
+public:
+ ImportingNow(std::atomic<bool>& importing) : m_importing{importing}
{
- assert(fImporting == false);
- fImporting = true;
+ assert(m_importing == false);
+ m_importing = true;
}
-
- ~CImportingNow()
+ ~ImportingNow()
{
- assert(fImporting == true);
- fImporting = false;
+ assert(m_importing == true);
+ m_importing = false;
}
};
@@ -864,7 +867,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile
ScheduleBatchPriority();
{
- CImportingNow imp;
+ ImportingNow imp{fImporting};
// -reindex
if (fReindex) {
@@ -930,7 +933,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile
StartShutdown();
return;
}
- } // End scope of CImportingNow
+ } // End scope of ImportingNow
chainman.ActiveChainstate().LoadMempool(mempool_path);
}
} // namespace node