diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index f8d5b1e36274..15ca2f4b1c17 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -153,6 +153,16 @@ QDateTime ClientModel::getLastBlockDate() const
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
}
+QString ClientModel::getLastBlockHash() const
+{
+ LOCK(cs_main);
+
+ if (chainActive.Tip())
+ return QString::fromStdString(chainActive.Tip()->GetBlockHash().ToString());
+
+ return QString::fromStdString(Params().GenesisBlock().GetHash().ToString()); // Genesis block's hash of current network
+}
+
long ClientModel::getMempoolSize() const
{
return mempool.size();
@@ -344,6 +354,7 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB
QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
Q_ARG(int, pIndex->nHeight),
Q_ARG(QDateTime, QDateTime::fromTime_t(pIndex->GetBlockTime())),
+ Q_ARG(QString, QString::fromStdString(pIndex->GetBlockHash().ToString())),
Q_ARG(double, clientmodel->getVerificationProgress(pIndex)),
Q_ARG(bool, fHeader));
nLastUpdateNotification = now;
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index ab7e31dc36e1..fe8b733e5247 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -72,6 +72,7 @@ class ClientModel : public QObject
double getVerificationProgress(const CBlockIndex *tip) const;
QDateTime getLastBlockDate() const;
+ QString getLastBlockHash() const;
//! Return true if core is doing initial block download
bool inInitialBlockDownload() const;
@@ -113,7 +114,7 @@ class ClientModel : public QObject
Q_SIGNALS:
void numConnectionsChanged(int count);
void masternodeListChanged() const;
- void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, bool header);
+ void numBlocksChanged(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header);
void additionalDataSyncProgressChanged(double nSyncProgress);
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
void islockCountChanged(size_t count);
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui
index e7992fdd3f3a..80d8c0bd2921 100644
--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -351,20 +351,43 @@
-
+
+
+ Last block hash
+
+
+
+ -
+
+
+ IBeamCursor
+
+
+ N/A
+
+
+ Qt::PlainText
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
Memory Pool
- -
+
-
Current number of transactions
- -
+
-
IBeamCursor
@@ -380,14 +403,14 @@
- -
+
-
Memory usage
- -
+
-
IBeamCursor
@@ -443,7 +466,7 @@
- -
+
-
Qt::Vertical
@@ -456,14 +479,14 @@
- -
+
-
InstantSend locks
- -
+
-
IBeamCursor
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 8b37a391b681..832bec12946c 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -602,8 +602,8 @@ void RPCConsole::setClientModel(ClientModel *model)
setNumConnections(model->getNumConnections());
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getVerificationProgress(nullptr), false);
- connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool)));
+ setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getLastBlockHash(), model->getVerificationProgress(nullptr), false);
+ connect(model, SIGNAL(numBlocksChanged(int,QDateTime,QString,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,QString,double,bool)));
updateNetworkState();
connect(model, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool)));
@@ -958,11 +958,12 @@ void RPCConsole::setNetworkActive(bool networkActive)
updateNetworkState();
}
-void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers)
+void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers)
{
if (!headers) {
ui->numberOfBlocks->setText(QString::number(count));
ui->lastBlockTime->setText(blockDate.toString());
+ ui->lastBlockHash->setText(blockHash);
}
}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 3f7aea19d5d1..419147d9cdac 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -112,8 +112,8 @@ public Q_SLOTS:
void setNetworkActive(bool networkActive);
/** Update number of masternodes shown in the UI */
void updateMasternodeCount();
- /** Set number of blocks and last block date shown in the UI */
- void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
+ /** Set number of blocks, last block date and last block hash shown in the UI */
+ void setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers);
/** Set size (number of transactions and memory usage) of the mempool in the UI */
void setMempoolSize(long numberOfTxs, size_t dynUsage);
/** Set number of InstantSend locks */