mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-26 15:36:19 +01:00
Correct units for "-dbcache" and "-prune"
All dbcache-related values in the code are measured in MiB (not in megabytes, MB) or in bytes. The GUI "-prune" values in GB are translated to the node values in MiB correctly. The maximum of the "-prune" QSpinBox is not limited by the default value of 99 (GB). Also, this improves log readability.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <qt/optionsmodel.h>
|
||||
|
||||
#include <qt/bitcoinunits.h>
|
||||
#include <qt/guiconstants.h>
|
||||
#include <qt/guiutil.h>
|
||||
|
||||
#include <interfaces/node.h>
|
||||
@@ -92,10 +93,10 @@ void OptionsModel::Init(bool resetSettings)
|
||||
settings.setValue("bPrune", false);
|
||||
if (!settings.contains("nPruneSize"))
|
||||
settings.setValue("nPruneSize", 2);
|
||||
// Convert prune size to MB:
|
||||
const uint64_t nPruneSizeMB = settings.value("nPruneSize").toInt() * 1000;
|
||||
if (!m_node.softSetArg("-prune", settings.value("bPrune").toBool() ? std::to_string(nPruneSizeMB) : "0")) {
|
||||
addOverriddenOption("-prune");
|
||||
// Convert prune size from GB to MiB:
|
||||
const uint64_t nPruneSizeMiB = (settings.value("nPruneSize").toInt() * GB_BYTES) >> 20;
|
||||
if (!m_node.softSetArg("-prune", settings.value("bPrune").toBool() ? std::to_string(nPruneSizeMiB) : "0")) {
|
||||
addOverriddenOption("-prune");
|
||||
}
|
||||
|
||||
if (!settings.contains("nDatabaseCache"))
|
||||
|
||||
Reference in New Issue
Block a user