|
12 | 12 |
|
13 | 13 | #include <qt/guiconstants.h>
|
14 | 14 | #include <qt/guiutil.h>
|
| 15 | +#include <qt/optionsmodel.h> |
15 | 16 |
|
16 | 17 | #include <interfaces/node.h>
|
17 | 18 | #include <util/system.h>
|
|
23 | 24 | #include <cmath>
|
24 | 25 |
|
25 | 26 | /* Total required space (in GB) depending on user choice (prune, not prune) */
|
26 |
| -static uint64_t requiredSpace; |
| 27 | +static int64_t requiredSpace; |
27 | 28 |
|
28 | 29 | /* Check free space asynchronously to prevent hanging the UI thread.
|
29 | 30 |
|
@@ -130,18 +131,18 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz
|
130 | 131 | );
|
131 | 132 | ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME));
|
132 | 133 |
|
133 |
| - uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0)); |
134 |
| - if (pruneTarget > 1) { // -prune=1 means enabled, above that it's a size in MB |
| 134 | + int64_t prune_target_mib = std::max<int64_t>(0, gArgs.GetArg("-prune", 0)); |
| 135 | + if (prune_target_mib > 1) { // -prune=1 means enabled, above that it's a size in MiB |
135 | 136 | ui->prune->setChecked(true);
|
136 | 137 | ui->prune->setEnabled(false);
|
137 | 138 | }
|
138 |
| - ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(pruneTarget ? pruneTarget / 1000 : DEFAULT_PRUNE_TARGET_GB)); |
| 139 | + const int prune_target_gb = PruneMiBtoGB(prune_target_mib); |
| 140 | + 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)); |
139 | 141 | requiredSpace = m_blockchain_size;
|
140 | 142 | QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
|
141 |
| - if (pruneTarget) { |
142 |
| - uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES); |
143 |
| - if (prunedGBs <= requiredSpace) { |
144 |
| - requiredSpace = prunedGBs; |
| 143 | + if (prune_target_gb) { |
| 144 | + if (prune_target_gb <= requiredSpace) { |
| 145 | + requiredSpace = prune_target_gb; |
145 | 146 | storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
|
146 | 147 | }
|
147 | 148 | ui->lblExplanation3->setVisible(true);
|
|
0 commit comments