diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 0900a35cc..566e8fa62 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -13,6 +13,7 @@
#include "checkpoints.h"
#include "clientversion.h"
#include "net.h"
+#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
@@ -88,6 +89,16 @@ QDateTime ClientModel::getLastBlockDate() const
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
}
+long ClientModel::getMempoolSize() const
+{
+ return mempool.size();
+}
+
+size_t ClientModel::getMempoolDynamicUsage() const
+{
+ return mempool.DynamicMemoryUsage();
+}
+
double ClientModel::getVerificationProgress() const
{
LOCK(cs_main);
@@ -122,6 +133,7 @@ void ClientModel::updateTimer()
Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
}
+ Q_EMIT mempoolSizeChanged(getMempoolSize(), getMempoolDynamicUsage());
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
}
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 627bdf862..493a75933 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -51,6 +51,11 @@ public:
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
int getNumBlocks() const;
+ //! Return number of transactions in the mempool
+ long getMempoolSize() const;
+ //! Return the dynamic memory usage of the mempool
+ size_t getMempoolDynamicUsage() const;
+
quint64 getTotalBytesRecv() const;
quint64 getTotalBytesSent() const;
@@ -89,6 +94,7 @@ private:
Q_SIGNALS:
void numConnectionsChanged(int count);
void numBlocksChanged(int count, const QDateTime& blockDate);
+ void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui
index 4117da57f..e81a27a83 100644
--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -23,7 +23,7 @@
&Information
-
+
12
@@ -47,7 +47,7 @@
- -
+
-
IBeamCursor
@@ -70,7 +70,7 @@
- -
+
-
IBeamCursor
@@ -96,7 +96,7 @@
- -
+
-
IBeamCursor
@@ -122,7 +122,7 @@
- -
+
-
IBeamCursor
@@ -148,7 +148,7 @@
- -
+
-
IBeamCursor
@@ -171,7 +171,7 @@
- -
+
-
IBeamCursor
@@ -194,7 +194,7 @@
- -
+
-
IBeamCursor
@@ -210,19 +210,6 @@
- -
-
-
-
- 75
- true
-
-
-
- Network
-
-
-
-
@@ -230,7 +217,7 @@
- -
+
-
IBeamCursor
@@ -253,7 +240,7 @@
- -
+
-
IBeamCursor
@@ -289,7 +276,7 @@
- -
+
-
IBeamCursor
@@ -306,13 +293,13 @@
-
-
+
Last block time
- -
+
-
IBeamCursor
@@ -329,20 +316,7 @@
-
-
-
- Qt::Vertical
-
-
-
- 20
- 20
-
-
-
-
- -
-
+
75
@@ -350,24 +324,110 @@
- Debug log file
+ Memory Pool
+
+
+
+ -
+
+
+ Current number of transactions
+
+
+
+ -
+
+
+ IBeamCursor
+
+
+ N/A
+
+
+ Qt::PlainText
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Network
-
-
-
- Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.
-
+
- &Open
-
-
- false
+ Memory usage
- -
+
-
+
+
+ IBeamCursor
+
+
+ N/A
+
+
+ Qt::PlainText
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+ 3
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 10
+ 5
+
+
+
+
+ -
+
+
+ Debug log file
+
+
+
+ -
+
+
+ Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.
+
+
+ &Open
+
+
+ false
+
+
+
+
+
+ -
Qt::Vertical
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 840170182..07ce0c284 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -343,6 +343,8 @@ void RPCConsole::setClientModel(ClientModel *model)
updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
+ connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t)));
+
// set up peer table
ui->peerWidget->setModel(model->getPeerTableModel());
ui->peerWidget->verticalHeader()->hide();
@@ -523,6 +525,16 @@ void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate)
ui->lastBlockTime->setText(blockDate.toString());
}
+void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
+{
+ ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
+
+ if (dynUsage < 1000000)
+ ui->mempoolSize->setText(QString::number(dynUsage/1000.0, 'f', 2) + " KB");
+ else
+ ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB");
+}
+
void RPCConsole::on_lineEdit_returnPressed()
{
QString cmd = ui->lineEdit->text();
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index d5932ff14..5e749336c 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -77,6 +77,8 @@ public Q_SLOTS:
void setNumConnections(int count);
/** Set number of blocks and last block date shown in the UI */
void setNumBlocks(int count, const QDateTime& blockDate);
+ /** Set size (number of transactions and memory usage) of the mempool in the UI */
+ void setMempoolSize(long numberOfTxs, size_t dynUsage);
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */