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

gui: show maximum mempool size in information window

This commit is contained in:
Sebastian Falbesoner 2024-06-20 18:01:58 +02:00
parent bbde6ffefe
commit 4a028cf54c
4 changed files with 11 additions and 10 deletions

View file

@ -53,7 +53,7 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO
connect(timer, &QTimer::timeout, [this] { connect(timer, &QTimer::timeout, [this] {
// no locking required at this point // no locking required at this point
// the following calls will acquire the required lock // the following calls will acquire the required lock
Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage()); Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage(), m_node.getMempoolMaxUsage());
Q_EMIT bytesChanged(m_node.getTotalBytesRecv(), m_node.getTotalBytesSent()); Q_EMIT bytesChanged(m_node.getTotalBytesRecv(), m_node.getTotalBytesSent());
}); });
connect(m_thread, &QThread::finished, timer, &QObject::deleteLater); connect(m_thread, &QThread::finished, timer, &QObject::deleteLater);

View file

@ -113,7 +113,7 @@ private:
Q_SIGNALS: Q_SIGNALS:
void numConnectionsChanged(int count); void numConnectionsChanged(int count);
void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state); void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state);
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes); void mempoolSizeChanged(long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes);
void networkActiveChanged(bool networkActive); void networkActiveChanged(bool networkActive);
void alertsChanged(const QString &warnings); void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);

View file

@ -1000,15 +1000,16 @@ void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVer
} }
} }
void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage) void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage)
{ {
ui->mempoolNumberTxs->setText(QString::number(numberOfTxs)); ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
if (dynUsage < 1000000) { const auto cur_usage_str = dynUsage < 1000000 ?
ui->mempoolSize->setText(QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2)); QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2) :
} else { QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2);
ui->mempoolSize->setText(QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2)); const auto max_usage_str = QObject::tr("%1 MB").arg(maxUsage / 1000000.0, 0, 'f', 2);
}
ui->mempoolSize->setText(cur_usage_str + " / " + max_usage_str);
} }
void RPCConsole::on_lineEdit_returnPressed() void RPCConsole::on_lineEdit_returnPressed()

View file

@ -121,7 +121,7 @@ public Q_SLOTS:
/** Set number of blocks and last block date shown in the UI */ /** Set number of blocks and last block date shown in the UI */
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype); void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype);
/** Set size (number of transactions and memory usage) of the mempool in the UI */ /** Set size (number of transactions and memory usage) of the mempool in the UI */
void setMempoolSize(long numberOfTxs, size_t dynUsage); void setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage);
/** Go forward or back in history */ /** Go forward or back in history */
void browseHistory(int offset); void browseHistory(int offset);
/** Scroll console view to end */ /** Scroll console view to end */