0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

Merge bitcoin-core/gui#697: Remove reindex special case from the progress bar label

faff2ba4f8 Remove reindex special case from the progress bar label (MarcoFalke)

Pull request description:

  The user knows which option they passed to the program, so it seems overly verbose to offer the user feedback whether or not they passed `-reindex`. Treat it as `DISK`, like all other cases that are treated as `DISK`:

  * `-reindex-chainstate`
  * `-loadblock`

ACKs for top commit:
  john-moffett:
    Re-ACK faff2ba4f8
  hebasto:
    ACK faff2ba4f8, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 7f110c4beb1451d26f32da3a60150dac91c8a7b8d1c01749017204712b73cc1b77578af492930e4b6704097a73ed051f77bc39d8f60e0ff15a797a201805312e
This commit is contained in:
MarcoFalke 2023-02-07 16:49:07 +01:00
commit 1bcabe6f2a
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
5 changed files with 10 additions and 23 deletions

View file

@ -177,11 +177,8 @@ public:
//! 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;

View file

@ -295,8 +295,7 @@ public:
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) {

View file

@ -1071,7 +1071,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
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) {
@ -1091,9 +1091,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
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;

View file

@ -146,15 +146,10 @@ uint256 ClientModel::getBestBlockHash()
return m_cached_tip_blocks;
}
enum BlockSource ClientModel::getBlockSource() const
BlockSource ClientModel::getBlockSource() const
{
if (m_node.getReindex())
return BlockSource::REINDEX;
else if (m_node.getImporting())
return BlockSource::DISK;
else if (getNumConnections() > 0)
return BlockSource::NETWORK;
if (m_node.isLoadingBlocks()) return BlockSource::DISK;
if (getNumConnections() > 0) return BlockSource::NETWORK;
return BlockSource::NONE;
}

View file

@ -32,9 +32,8 @@ QT_END_NAMESPACE
enum class BlockSource {
NONE,
REINDEX,
DISK,
NETWORK
NETWORK,
};
enum class SyncType {
@ -72,8 +71,8 @@ public:
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;