MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SetPruneTargetGB

Method SetPruneTargetGB

src/qt/optionsmodel.cpp:350–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350void OptionsModel::SetPruneTargetGB(int prune_target_gb)
351{
352 const common::SettingsValue cur_value = node().getPersistentSetting("prune");
353 const common::SettingsValue new_value = PruneSetting(prune_target_gb > 0, prune_target_gb);
354
355 // Force setting to take effect. It is still safe to change the value at
356 // this point because this function is only called after the intro screen is
357 // shown, before the node starts.
358 node().forceSetting("prune", new_value);
359
360 // Update settings.json if value configured in intro screen is different
361 // from saved value. Avoid writing settings.json if bitcoin.conf value
362 // doesn't need to be overridden.
363 if (PruneEnabled(cur_value) != PruneEnabled(new_value) ||
364 PruneSizeGB(cur_value) != PruneSizeGB(new_value)) {
365 // Call UpdateRwSetting() instead of setOption() to avoid setting
366 // RestartRequired flag
367 UpdateRwSetting(node(), Prune, "", new_value);
368 }
369
370 // Keep previous pruning size, if pruning was disabled.
371 if (PruneEnabled(cur_value)) {
372 UpdateRwSetting(node(), Prune, "-prev", PruneEnabled(new_value) ? common::SettingsValue{} : cur_value);
373 }
374}
375
376// read QSettings values and return them
377QVariant OptionsModel::data(const QModelIndex & index, int role) const

Callers 1

InitPruneSettingMethod · 0.80

Calls 6

PruneSettingFunction · 0.85
PruneEnabledFunction · 0.85
PruneSizeGBFunction · 0.85
UpdateRwSettingFunction · 0.85
getPersistentSettingMethod · 0.80
forceSettingMethod · 0.80

Tested by

no test coverage detected