aboutsummaryrefslogtreecommitdiff
path: root/src/qt/intro.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/intro.cpp')
-rw-r--r--src/qt/intro.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index f064556ae5..183c2fcfb6 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -12,6 +12,7 @@
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
+#include <qt/optionsmodel.h>
#include <interfaces/node.h>
#include <util/system.h>
@@ -23,7 +24,7 @@
#include <cmath>
/* Total required space (in GB) depending on user choice (prune, not prune) */
-static uint64_t requiredSpace;
+static int64_t requiredSpace;
/* Check free space asynchronously to prevent hanging the UI thread.
@@ -130,18 +131,18 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz
);
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME));
- uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0));
- if (pruneTarget > 1) { // -prune=1 means enabled, above that it's a size in MB
+ int64_t prune_target_mib = std::max<int64_t>(0, gArgs.GetArg("-prune", 0));
+ if (prune_target_mib > 1) { // -prune=1 means enabled, above that it's a size in MiB
ui->prune->setChecked(true);
ui->prune->setEnabled(false);
}
- ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(pruneTarget ? pruneTarget / 1000 : DEFAULT_PRUNE_TARGET_GB));
+ const int prune_target_gb = PruneMiBtoGB(prune_target_mib);
+ ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(prune_target_gb ? prune_target_gb : DEFAULT_PRUNE_TARGET_GB));
requiredSpace = m_blockchain_size;
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
- if (pruneTarget) {
- uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
- if (prunedGBs <= requiredSpace) {
- requiredSpace = prunedGBs;
+ if (prune_target_gb) {
+ if (prune_target_gb <= requiredSpace) {
+ requiredSpace = prune_target_gb;
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
}
ui->lblExplanation3->setVisible(true);