diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2019-09-12 14:59:58 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2019-09-12 15:00:51 +0200 |
commit | 884f7cc81b478b599ed8d43ebe80578ea9cdb279 (patch) | |
tree | e2f765704678317f217c4df6ecc5e077f2c847a9 /src/interfaces | |
parent | ca97d292ce60f672cc71610c9e2fb76f57d768fc (diff) | |
parent | 9924bce317b96ab0c57efb99330abd11b6f16b9a (diff) |
Merge #16714: gui: add prune to intro screen with smart default
9924bce317b96ab0c57efb99330abd11b6f16b9a [gui] intro: enable pruning by default unless disk is big (Sjors Provoost)
c8de347a9d6c88fe67d77aba6fcce1b7fd66791c [gui] intro: add prune preference (Sjors Provoost)
1bbc49d2078ee53488e214d00eb47462687b05c5 [gui] intro: inform caller if intro was shown (Sjors Provoost)
1957103786f97135f35ababc97efa1b481865eb0 [gui] add explicit prune setter (Sjors Provoost)
1bccf6a52d7fc08d8f605cfb2edc3277ec299c72 [node] add forceSetArg to interface (Sjors Provoost)
Pull request description:
This adds a checkbox to the intro screen to enable pruning from the get go.
If the user has plenty of space, it's unchecked by default:
<img width="671" alt="big" src="https://user-images.githubusercontent.com/10217/63641289-10339000-c6ac-11e9-98d7-caf64dff0da6.png">
If the user has insufficient space it's checked by default:
<img width="897" alt="low" src="https://user-images.githubusercontent.com/10217/63641276-d4002f80-c6ab-11e9-9f5b-a53472f814ff.png">
When the user has barely enough space and is likely to need pruning in the near future, this is shown in yellow and we also check the prune box:
<img width="662" alt="medium" src="https://user-images.githubusercontent.com/10217/63641294-1c1f5200-c6ac-11e9-8ecb-6b69e42b1ece.png">
The cut-off for this 10 GB above `m_assumed_blockchain_size` (`=240` in `chainparams.cpp`).
If the user launches the first time with `-prune=...` then we disable the check box and display the correct size (rounded to GB):
<img width="658" alt="Schermafbeelding 2019-08-24 om 20 23 14" src="https://user-images.githubusercontent.com/10217/63641351-09594d00-c6ad-11e9-94fe-fe5ed562e109.png">
The 2 GB default matches the settings default. The user can't change it in the intro screen, but can change it later. I'm tempted to increase that default to 10 GB, and then have the intro screen reduce it if space is really tight.
Tips for testing:
* move your existing data dir elsewhere
* wipe data dir at every restart (behavior is different if it exists)
* launch with `bitcoin-qt -resetguisettings -lang=en` (there's some space issues in different languages)
* fake your free space by changing `intro.cpp` line 90: `freeBytesAvailable = 5000000000; // 5 GB`
* try both testnet and mainnet, because settings are seperate. In particular note how step 7 in `GuiMain` switches where `QTSettings settings` points to; this had me thoroughly confused on testnet, because I was setting them too early.
ACKs for top commit:
jonasschnelli:
Tested ACK 9924bce317b96ab0c57efb99330abd11b6f16b9a
ryanofsky:
utACK 9924bce317b96ab0c57efb99330abd11b6f16b9a. The changes are very logical, and implement the feature in a clean that way that doesn't add a lot of complication and shouldn't interfere with future improvements. I looked at Luke's branch too, and I think there's also a lot of great stuff there that seems fully compatible with this change.
Tree-SHA512: 9523961451c53aebd347716976bc3a4a398f989dc21e9bbbd357060bd11a8f46c435f068bd421bb31ccb08e55445ef67bc347d8d19a4fb8fde9d6d3f9a3bcbb0
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/node.cpp | 1 | ||||
-rw-r--r-- | src/interfaces/node.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index ccafc3ac8c..c80a8789fc 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -62,6 +62,7 @@ public: return gArgs.ParseParameters(argc, argv, error); } bool readConfigFiles(std::string& error) override { return gArgs.ReadConfigFiles(error, true); } + void forceSetArg(const std::string& arg, const std::string& value) override { gArgs.ForceSetArg(arg, value); } bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); } bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); } void selectParams(const std::string& network) override { SelectParams(network); } diff --git a/src/interfaces/node.h b/src/interfaces/node.h index e8c3d0b721..2f4f396e72 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -46,6 +46,9 @@ public: //! Set command line arguments. virtual bool parseParameters(int argc, const char* const argv[], std::string& error) = 0; + //! Set a command line argument + virtual void forceSetArg(const std::string& arg, const std::string& value) = 0; + //! Set a command line argument if it doesn't already have a value virtual bool softSetArg(const std::string& arg, const std::string& value) = 0; |