Add BlockManager::LoadingBlocks()

This commit is contained in:
MarcoFalke
2023-01-03 13:03:43 +01:00
parent 599e941c19
commit fa0f0436d8
4 changed files with 19 additions and 16 deletions

View File

@@ -176,6 +176,11 @@ public:
/** Store block on disk. If dbp is not nullptr, then it provides the known position of the block within a block file on disk. */
FlatFilePos SaveBlockToDisk(const CBlock& block, int nHeight, CChain& active_chain, const CChainParams& chainparams, const FlatFilePos* dbp);
[[nodiscard]] bool LoadingBlocks() const
{
return fImporting || fReindex;
}
/** Calculate the amount of disk space the block & undo files currently use */
uint64_t CalculateCurrentUsage();

View File

@@ -711,8 +711,9 @@ public:
LOCK(::cs_main);
return chainman().m_blockman.m_have_pruned;
}
bool isReadyToBroadcast() override { return !node::fImporting && !node::fReindex && !isInitialBlockDownload(); }
bool isInitialBlockDownload() override {
bool isReadyToBroadcast() override { return !chainman().m_blockman.LoadingBlocks() && !isInitialBlockDownload(); }
bool isInitialBlockDownload() override
{
return chainman().ActiveChainstate().IsInitialBlockDownload();
}
bool shutdownRequested() override { return ShutdownRequested(); }