diff --git a/doc/release-notes.md b/doc/release-notes.md
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -3,10 +3,16 @@
This release includes the following features and fixes:
+ - It is now possible to unload wallets dynamically at runtime. This feature is
+ currently only available through the RPC interface.
+
+GUI changes
+-----------
- Wallets loaded dynamically through the RPC interface may now be displayed in
the bitcoin-qt GUI.
- The default wallet will now be labeled `[default wallet]` in the bitcoin-qt
GUI if no name is provided by the `-wallet` option on start up.
- - It is now possible to unload wallets dynamically at runtime. This feature is
- currently only available through the RPC interface.
- Wallets dynamically unloaded will now be reflected in the gui.
+ - Block storage can be limited under Preferences, in the Main tab. Undoing
+ this setting requires downloading the full blockchain again. This mode is
+ incompatible with -txindex and -rescan.
diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui
--- a/src/qt/forms/optionsdialog.ui
+++ b/src/qt/forms/optionsdialog.ui
@@ -37,6 +37,69 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 5
+
+
+
+
+ -
+
+
-
+
+
+ Disables some advanced features but all blocks will still be fully validated. Reverting this setting requires re-downloading the entire blockchain. Actual disk usage may be somewhat higher.
+
+
+ Prune &block storage to
+
+
+
+ -
+
+
+ -
+
+
+ GB
+
+
+ Qt::PlainText
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Reverting this setting requires re-downloading the entire blockchain.
+
+
+ Qt::PlainText
+
+
+
-
-
@@ -81,7 +144,7 @@
-
-
+
-
@@ -103,7 +166,7 @@
-
-
+
Qt::Horizontal
diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h
--- a/src/qt/optionsdialog.h
+++ b/src/qt/optionsdialog.h
@@ -50,6 +50,7 @@
void on_hideTrayIcon_stateChanged(int fState);
+ void togglePruneWarning(bool enabled);
void showRestartWarning(bool fPersistent = false);
void clearStatusLabel();
void updateProxyValidationState();
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -31,8 +31,21 @@
/* 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);
+ ui->pruneWarning->setStyleSheet("QLabel { color: red; }");
+
+ ui->pruneSize->setEnabled(false);
+ connect(ui->prune, SIGNAL(toggled(bool)), ui->pruneSize,
+ SLOT(setEnabled(bool)));
/* Network elements init */
#ifndef USE_UPNP
@@ -153,6 +166,11 @@
* here so init via mapper doesn't trigger them) */
/* Main */
+ connect(ui->prune, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
+ connect(ui->prune, SIGNAL(clicked(bool)), this,
+ SLOT(togglePruneWarning(bool)));
+ connect(ui->pruneSize, SIGNAL(valueChanged(int)), this,
+ SLOT(showRestartWarning()));
connect(ui->databaseCache, SIGNAL(valueChanged(int)), this,
SLOT(showRestartWarning()));
connect(ui->threadsScriptVerif, SIGNAL(valueChanged(int)), this,
@@ -179,6 +197,8 @@
mapper->addMapping(ui->threadsScriptVerif,
OptionsModel::ThreadsScriptVerif);
mapper->addMapping(ui->databaseCache, OptionsModel::DatabaseCache);
+ mapper->addMapping(ui->prune, OptionsModel::Prune);
+ mapper->addMapping(ui->pruneSize, OptionsModel::PruneSize);
/* Wallet */
mapper->addMapping(ui->spendZeroConfChange,
@@ -267,6 +287,10 @@
}
}
+void OptionsDialog::togglePruneWarning(bool enabled) {
+ ui->pruneWarning->setVisible(!ui->pruneWarning->isVisible());
+}
+
void OptionsDialog::showRestartWarning(bool fPersistent) {
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -50,6 +50,8 @@
Language, // QString
CoinControlFeatures, // bool
ThreadsScriptVerif, // int
+ Prune, // bool
+ PruneSize, // int
DatabaseCache, // int
SpendZeroConfChange, // bool
Listen, // bool
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -98,6 +98,20 @@
// by command-line and show this in the UI.
// Main
+ if (!settings.contains("bPrune")) {
+ settings.setValue("bPrune", false);
+ }
+ if (!settings.contains("nPruneSize")) {
+ settings.setValue("nPruneSize", 2);
+ }
+ // Convert prune size to MB:
+ const uint64_t nPruneSizeMB = settings.value("nPruneSize").toInt() * 1000;
+ if (!m_node.softSetArg("-prune", settings.value("bPrune").toBool()
+ ? std::to_string(nPruneSizeMB)
+ : "0")) {
+ addOverriddenOption("-prune");
+ }
+
if (!settings.contains("nDatabaseCache")) {
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
}
@@ -323,6 +337,10 @@
return settings.value("language");
case CoinControlFeatures:
return fCoinControlFeatures;
+ case Prune:
+ return settings.value("bPrune");
+ case PruneSize:
+ return settings.value("nPruneSize");
case DatabaseCache:
return settings.value("nDatabaseCache");
case ThreadsScriptVerif:
@@ -444,6 +462,18 @@
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
Q_EMIT coinControlFeaturesChanged(fCoinControlFeatures);
break;
+ case Prune:
+ if (settings.value("bPrune") != value) {
+ settings.setValue("bPrune", value);
+ setRestartRequired(true);
+ }
+ break;
+ case PruneSize:
+ if (settings.value("nPruneSize") != value) {
+ settings.setValue("nPruneSize", value);
+ setRestartRequired(true);
+ }
+ break;
case DatabaseCache:
if (settings.value("nDatabaseCache") != value) {
settings.setValue("nDatabaseCache", value);