mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
Pass fImporting to ImportingNow helper class
This commit is contained in:
@ -844,17 +844,20 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
|
|||||||
return blockPos;
|
return blockPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CImportingNow {
|
class ImportingNow
|
||||||
CImportingNow()
|
|
||||||
{
|
{
|
||||||
assert(fImporting == false);
|
std::atomic<bool>& m_importing;
|
||||||
fImporting = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
~CImportingNow()
|
public:
|
||||||
|
ImportingNow(std::atomic<bool>& importing) : m_importing{importing}
|
||||||
{
|
{
|
||||||
assert(fImporting == true);
|
assert(m_importing == false);
|
||||||
fImporting = 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();
|
ScheduleBatchPriority();
|
||||||
|
|
||||||
{
|
{
|
||||||
CImportingNow imp;
|
ImportingNow imp{fImporting};
|
||||||
|
|
||||||
// -reindex
|
// -reindex
|
||||||
if (fReindex) {
|
if (fReindex) {
|
||||||
@ -930,7 +933,7 @@ void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFile
|
|||||||
StartShutdown();
|
StartShutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // End scope of CImportingNow
|
} // End scope of ImportingNow
|
||||||
chainman.ActiveChainstate().LoadMempool(mempool_path);
|
chainman.ActiveChainstate().LoadMempool(mempool_path);
|
||||||
}
|
}
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
Reference in New Issue
Block a user