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

@@ -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));
if (dynUsage < 1000000) {
ui->mempoolSize->setText(QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2));
} else {
ui->mempoolSize->setText(QObject::tr("%1 MB").arg(dynUsage / 1000000.0, 0, 'f', 2));
}
const auto cur_usage_str = dynUsage < 1000000 ?
QObject::tr("%1 kB").arg(dynUsage / 1000.0, 0, 'f', 2) :
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()
@@ -1400,4 +1401,4 @@ void RPCConsole::updateWindowTitle()
const QString chainType = QString::fromStdString(Params().GetChainTypeString());
const QString title = tr("Node window - [%1]").arg(chainType);
this->setWindowTitle(title);
}
}