mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge #15163: Correct units for "-dbcache" and "-prune"
6f6514a080Correct units for "-dbcache" and "-prune" (Hennadii Stepanov) Pull request description: Actually, all `dbcache`-related values in the code are measured in MiB (not in megabytes, MB) or in bytes (e.g., `nTotalCache`). See: https://github.com/bitcoin/bitcoin/blob/master/src/txdb.hba8c8b2227/src/init.cpp (L1405-L1424)Also, "-prune" is fixed: 1. The GUI values in GB are translated to the node values in MiB correctly. 2. The maximum of the "prune" `QSpinBox` is not limited by default value of 99 (GB). Fix: #15106 Tree-SHA512: 151ec43b31b1074db8b345fedb1dcc10bde225899a5296bfc183f57e1553d13ac27db8db100226646769ad03c9fcab29d88763065a471757c6c41ac51108459d
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <qt/forms/ui_optionsdialog.h>
|
||||
|
||||
#include <qt/bitcoinunits.h>
|
||||
#include <qt/guiconstants.h>
|
||||
#include <qt/guiutil.h>
|
||||
#include <qt/optionsmodel.h>
|
||||
|
||||
@@ -37,10 +38,6 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
||||
/* Main elements init */
|
||||
ui->databaseCache->setMinimum(nMinDbCache);
|
||||
ui->databaseCache->setMaximum(nMaxDbCache);
|
||||
static const uint64_t GiB = 1024 * 1024 * 1024;
|
||||
static const uint64_t nMinDiskSpace = MIN_DISK_SPACE_FOR_BLOCK_FILES / GiB +
|
||||
(MIN_DISK_SPACE_FOR_BLOCK_FILES % GiB) ? 1 : 0;
|
||||
ui->pruneSize->setMinimum(nMinDiskSpace);
|
||||
ui->threadsScriptVerif->setMinimum(-GetNumCores());
|
||||
ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
|
||||
ui->pruneWarning->setVisible(false);
|
||||
@@ -167,6 +164,10 @@ void OptionsDialog::setModel(OptionsModel *_model)
|
||||
mapper->toFirst();
|
||||
|
||||
updateDefaultProxyNets();
|
||||
|
||||
// Prune values are in GB to be consistent with intro.cpp
|
||||
static constexpr uint64_t nMinDiskSpace = (MIN_DISK_SPACE_FOR_BLOCK_FILES / GB_BYTES) + (MIN_DISK_SPACE_FOR_BLOCK_FILES % GB_BYTES) ? 1 : 0;
|
||||
ui->pruneSize->setRange(nMinDiskSpace, _model->node().getAssumedBlockchainSize());
|
||||
}
|
||||
|
||||
/* warn when one of the following settings changes by user action (placed here so init via mapper doesn't trigger them) */
|
||||
|
||||
Reference in New Issue
Block a user