Skip to content

Commit fa442b1

Browse files
author
MarcoFalke
committed
Pass fImporting to ImportingNow helper class
1 parent fa177d7 commit fa442b1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/node/blockstorage.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -844,17 +844,20 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
844844
return blockPos;
845845
}
846846

847-
struct CImportingNow {
848-
CImportingNow()
847+
class ImportingNow
848+
{
849+
std::atomic<bool>& m_importing;
850+
851+
public:
852+
ImportingNow(std::atomic<bool>& importing) : m_importing{importing}
849853
{
850-
assert(fImporting == false);
851-
fImporting = true;
854+
assert(m_importing == false);
855+
m_importing = true;
852856
}
853-
854-
~CImportingNow()
857+
~ImportingNow()
855858
{
856-
assert(fImporting == true);
857-
fImporting = false;
859+
assert(m_importing == true);
860+
m_importing = false;
858861
}
859862
};
860863

@@ -864,7 +867,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile
864867
ScheduleBatchPriority();
865868

866869
{
867-
CImportingNow imp;
870+
ImportingNow imp{fImporting};
868871

869872
// -reindex
870873
if (fReindex) {
@@ -930,7 +933,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile
930933
StartShutdown();
931934
return;
932935
}
933-
} // End scope of CImportingNow
936+
} // End scope of ImportingNow
934937
chainman.ActiveChainstate().LoadMempool(mempool_path);
935938
}
936939
} // namespace node

0 commit comments

Comments
 (0)