Skip to content

Commit f5aaeae

Browse files
committed
Merge #15801: Bugfix: GUI: Options: Initialise prune setting range before loading current value, and remove upper bound limit
8a33f4d GUI: Options: Remove the upper-bound limit from pruning size setting (Luke Dashjr) 4ddeb2f 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 8a33f4d laanwj: utACK 8a33f4d promag: utACK 8a33f4d. Tree-SHA512: 480570fa243ab5cc76af76fded18cb8cb2d3194b9f050fec5e03ca551edeeda72ee8b06312e200a9e49404ec1cdffa62f7150cf9982ec1b282f17d90879ce438
2 parents 693c743 + 8a33f4d commit f5aaeae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/qt/optionsdialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ void OptionsDialog::setModel(OptionsModel *_model)
154154
if (_model->isRestartRequired())
155155
showRestartWarning(true);
156156

157+
// Prune values are in GB to be consistent with intro.cpp
158+
static constexpr uint64_t nMinDiskSpace = (MIN_DISK_SPACE_FOR_BLOCK_FILES / GB_BYTES) + (MIN_DISK_SPACE_FOR_BLOCK_FILES % GB_BYTES) ? 1 : 0;
159+
ui->pruneSize->setRange(nMinDiskSpace, std::numeric_limits<int>::max());
160+
157161
QString strLabel = _model->getOverriddenByCommandLine();
158162
if (strLabel.isEmpty())
159163
strLabel = tr("none");
@@ -164,10 +168,6 @@ void OptionsDialog::setModel(OptionsModel *_model)
164168
mapper->toFirst();
165169

166170
updateDefaultProxyNets();
167-
168-
// Prune values are in GB to be consistent with intro.cpp
169-
static constexpr uint64_t nMinDiskSpace = (MIN_DISK_SPACE_FOR_BLOCK_FILES / GB_BYTES) + (MIN_DISK_SPACE_FOR_BLOCK_FILES % GB_BYTES) ? 1 : 0;
170-
ui->pruneSize->setRange(nMinDiskSpace, _model->node().getAssumedBlockchainSize());
171171
}
172172

173173
/* warn when one of the following settings changes by user action (placed here so init via mapper doesn't trigger them) */

0 commit comments

Comments
 (0)