diff --git a/src/interfaces/node.h b/src/interfaces/node.h --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -166,11 +166,8 @@ //! Is initial block download. virtual bool isInitialBlockDownload() = 0; - //! Get reindex. - virtual bool getReindex() = 0; - - //! Get importing. - virtual bool getImporting() = 0; + //! Is loading blocks. + virtual bool isLoadingBlocks() = 0; //! Set network active. virtual void setNetworkActive(bool active) = 0; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -269,8 +269,9 @@ bool isInitialBlockDownload() override { return chainman().ActiveChainstate().IsInitialBlockDownload(); } - bool getReindex() override { return node::fReindex; } - bool getImporting() override { return node::fImporting; } + bool isLoadingBlocks() override { + return node::fReindex || node::fImporting; + } void setNetworkActive(bool active) override { if (m_context->connman) { m_context->connman->SetNetworkActive(active); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1119,7 +1119,7 @@ statusBar()->clearMessage(); // Acquire current block source - enum BlockSource blockSource = clientModel->getBlockSource(); + BlockSource blockSource{clientModel->getBlockSource()}; switch (blockSource) { case BlockSource::NETWORK: if (synctype == SyncType::HEADER_PRESYNC) { @@ -1139,9 +1139,6 @@ progressBarLabel->setText(tr("Processing blocks on disk...")); } break; - case BlockSource::REINDEX: - progressBarLabel->setText(tr("Reindexing blocks on disk...")); - break; case BlockSource::NONE: if (synctype != SyncType::BLOCK_SYNC) { return; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -31,7 +31,11 @@ class QTimer; QT_END_NAMESPACE -enum class BlockSource { NONE, REINDEX, DISK, NETWORK }; +enum class BlockSource { + NONE, + DISK, + NETWORK, +}; enum class SyncType { HEADER_PRESYNC, HEADER_SYNC, BLOCK_SYNC }; @@ -63,8 +67,8 @@ int getHeaderTipHeight() const; int64_t getHeaderTipTime() const; - //! Returns enum BlockSource of the current importing/syncing state - enum BlockSource getBlockSource() const; + //! Returns the block source of the current importing/syncing state + BlockSource getBlockSource() const; //! Return warnings to be displayed in status bar QString getStatusBarWarnings() const; diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -134,15 +134,13 @@ return m_cached_tip_blocks; } -enum BlockSource ClientModel::getBlockSource() const { - if (m_node.getReindex()) { - return BlockSource::REINDEX; - } else if (m_node.getImporting()) { +BlockSource ClientModel::getBlockSource() const { + if (m_node.isLoadingBlocks()) { return BlockSource::DISK; - } else if (getNumConnections() > 0) { + } + if (getNumConnections() > 0) { return BlockSource::NETWORK; } - return BlockSource::NONE; }