util: Replace magics with DEFAULT_PRUNE_TARGET_GB

This commit does not change behavior.
This commit is contained in:
Hennadii Stepanov
2019-11-12 12:03:29 +02:00
parent 5622d8f315
commit a82bd8fa57
3 changed files with 5 additions and 2 deletions

View File

@ -51,4 +51,7 @@ static const int TOOLTIP_WRAP_THRESHOLD = 80;
/* One gigabyte (GB) in bytes */
static constexpr uint64_t GB_BYTES{1000000000};
// Default prune target displayed in GUI.
static constexpr int DEFAULT_PRUNE_TARGET_GB{2};
#endif // BITCOIN_QT_GUICONSTANTS_H

View File

@ -135,7 +135,7 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz
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 : 2));
ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(pruneTarget ? pruneTarget / 1000 : 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) {

View File

@ -91,7 +91,7 @@ void OptionsModel::Init(bool resetSettings)
if (!settings.contains("bPrune"))
settings.setValue("bPrune", false);
if (!settings.contains("nPruneSize"))
settings.setValue("nPruneSize", 2);
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
SetPrune(settings.value("bPrune").toBool());
if (!settings.contains("nDatabaseCache"))