HomePhabricator

[backport#17696] qt: Force set nPruneSize in QSettings after the intro dialog

Description

[backport#17696] qt: Force set nPruneSize in QSettings after the intro dialog

Summary:
af112ab62895b145660f4cd7ff842e9cfea2a530 qt: Rename SetPrune() to InitializePruneSetting() (Hennadii Stepanov)
b0bfbe50282877a1eee87118902901a280d6656d refactor: Drop `bool force' parameter (Hennadii Stepanov)
68c9bbe9bc91f882404556998666b1b5acea60e4 qt: Force set nPruneSize in QSettings after intro (Hennadii Stepanov)
a82bd8fa5708c16d1db3edc4e82d70788eb5af19 util: Replace magics with DEFAULT_PRUNE_TARGET_GB (Hennadii Stepanov)

Pull request description:

On master (5622d8f3156a293e61d0964c33d4b21d8c9fd5e0), having `QSettings` set already
```
$ grep nPruneSize ~/.config/Bitcoin/Bitcoin-Qt-testnet.conf
nPruneSize=6
```

enabling prune option in the intro dialog

```
$ ./src/qt/bitcoin-qt -choosedatadir -testnet
```
![DeepinScreenshot_select-area_20191208120425](https://user-images.githubusercontent.com/32963518/70388183-eed68580-19b6-11ea-9aa1-f9ad9aaa68a6.png)

has no effect:
```
$ grep Prune ~/.bitcoin/testnet3/debug.log
2019-12-08T10:04:41Z Prune configured to target 5722 MiB on disk for block and undo files.
```

---

With this PR:
```
$ grep Prune ~/.bitcoin/testnet3/debug.log
2019-12-08T10:20:35Z Prune configured to target 1907 MiB on disk for block and undo files.
```

This PR has been split of #17453 (the first two commits) as it fixes an orthogonal bug.

Refs:
- https://github.com/bitcoin/bitcoin/pull/17453#discussion_r345424240
- https://github.com/bitcoin/bitcoin/pull/17453#discussion_r350960201

Backport of Core PR17696

Test Plan:

ninja all check check-functional
./src/qt/bitcoin-qt -choosedatadir -testnet

start a new datadir with prune option selected, make sure the debug.log
returns the correct value (~2GB)

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8913

Details

Provenance
fanquake <fanquake@gmail.com>Authored on Jan 8 2020, 14:03
majcostaCommitted on Jan 14 2021, 14:39
majcostaPushed on Jan 14 2021, 14:39
Reviewer
Restricted Project
Differential Revision
D8913: [backport#17696] qt: Force set nPruneSize in QSettings after the intro dialog
Parents
rABC3393b7018419: Remove PID file at the very end
Branches
Unknown
Tags
Unknown