Merge #15801: Bugfix: GUI: Options: Initialise prune setting range before loading current value, and remove upper bound limit

8a33f4d63f GUI: Options: Remove the upper-bound limit from pruning size setting (Luke Dashjr)
4ddeb2f860 GUI: Options: Set the range of pruning size before loading its value (Luke Dashjr)

Pull request description:

  This fixes two bugs:

  1. The prune setting range was set *after* loading the current value. If users had a prune of (eg) 200, it would get limited to 99 before the range was raised. This is fixed by setting the range first.
  2. The prune setting was limited to <= the chainparams' "assumed blockchain size". There's no reason for this limit (the UX is the same either way), and there are use cases it breaks (eg, setting a prune size such that it begins pruning at some future point). Therefore, I raised it to the max value.

  This is a daggy fix, so should cleanly merge to both master and 0.18 branches.

ACKs for commit 8a33f4:
  MarcoFalke:
    utACK 8a33f4d63f
  laanwj:
    utACK 8a33f4d63f
  promag:
    utACK 8a33f4d.

Tree-SHA512: 480570fa243ab5cc76af76fded18cb8cb2d3194b9f050fec5e03ca551edeeda72ee8b06312e200a9e49404ec1cdffa62f7150cf9982ec1b282f17d90879ce438
This commit is contained in:
Wladimir J. van der Laan 2019-04-18 17:46:32 +02:00
commit f5aaeae0cd
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -154,6 +154,10 @@ void OptionsDialog::setModel(OptionsModel *_model)
if (_model->isRestartRequired())
showRestartWarning(true);
// 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, std::numeric_limits<int>::max());
QString strLabel = _model->getOverriddenByCommandLine();
if (strLabel.isEmpty())
strLabel = tr("none");
@ -164,10 +168,6 @@ 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) */