Skip to content

Commit ef77fdf

Browse files
committed
GUI: topbar, removing not used block source.
ClientModel::getBlockSource is locking cs_nodes every second and the result is currently not used.
1 parent e9c160a commit ef77fdf

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

src/qt/clientmodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ int64_t ClientModel::getLastBlockProcessedTime() const
150150
return cacheTip == nullptr ? Params().GenesisBlock().GetBlockTime() : cacheTip->GetBlockTime();
151151
}
152152

153+
bool ClientModel::isTipCached() const
154+
{
155+
return cacheTip;
156+
}
157+
153158
double ClientModel::getVerificationProgress() const
154159
{
155160
return Checkpoints::GuessVerificationProgress(cacheTip);

src/qt/clientmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ClientModel : public QObject
6868
int getLastBlockProcessedHeight() const;
6969
int64_t getLastBlockProcessedTime() const;
7070
double getVerificationProgress() const;
71+
bool isTipCached() const;
7172

7273
quint64 getTotalBytesRecv() const;
7374
quint64 getTotalBytesSent() const;

src/qt/pivx/topbar.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -474,26 +474,7 @@ void TopBar::setNumBlocks(int count)
474474
if (!clientModel)
475475
return;
476476

477-
// Acquire current block source
478-
enum BlockSource blockSource = clientModel->getBlockSource();
479-
std::string text = "";
480-
switch (blockSource) {
481-
case BLOCK_SOURCE_NETWORK:
482-
text = "Synchronizing..";
483-
break;
484-
case BLOCK_SOURCE_DISK:
485-
text = "Importing blocks from disk..";
486-
break;
487-
case BLOCK_SOURCE_REINDEX:
488-
text = "Reindexing blocks on disk..";
489-
break;
490-
case BLOCK_SOURCE_NONE:
491-
// Case: not Importing, not Reindexing and no network connection
492-
text = "No block source available..";
493-
ui->pushButtonSync->setChecked(false);
494-
break;
495-
}
496-
477+
std::string text;
497478
bool needState = true;
498479
if (masternodeSync.IsBlockchainSynced()) {
499480
// chain synced
@@ -523,7 +504,7 @@ void TopBar::setNumBlocks(int count)
523504
Q_EMIT walletSynced(false);
524505
}
525506

526-
if (needState) {
507+
if (needState && clientModel->isTipCached()) {
527508
// Represent time from last generated block in human readable text
528509
QDateTime lastBlockDate = clientModel->getLastBlockDate();
529510
QDateTime currentDate = QDateTime::currentDateTime();

0 commit comments

Comments
 (0)