mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 01:41:57 +02:00
Pass fImporting to ImportingNow helper class
This commit is contained in:
parent
fa177d7b6b
commit
fa442b1377
@ -844,17 +844,20 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
|
||||
return blockPos;
|
||||
}
|
||||
|
||||
struct CImportingNow {
|
||||
CImportingNow()
|
||||
{
|
||||
assert(fImporting == false);
|
||||
fImporting = true;
|
||||
}
|
||||
class ImportingNow
|
||||
{
|
||||
std::atomic<bool>& m_importing;
|
||||
|
||||
~CImportingNow()
|
||||
public:
|
||||
ImportingNow(std::atomic<bool>& importing) : m_importing{importing}
|
||||
{
|
||||
assert(fImporting == true);
|
||||
fImporting = false;
|
||||
assert(m_importing == false);
|
||||
m_importing = true;
|
||||
}
|
||||
~ImportingNow()
|
||||
{
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user