Skip to content

Conversation

@Sjors
Copy link
Member

@Sjors Sjors commented Apr 19, 2018

bool fPruneMode is replaced by an enum class to include an UNKNOWN state.

fHavePruned is used to set fPruneNode if argument is not explictly set.

@Sjors Sjors force-pushed the 2018/04/implicit_prune branch from 2303d0f to 34b38ab Compare April 19, 2018 14:28
@Sjors
Copy link
Member Author

Sjors commented Apr 19, 2018

I may have been a bit overzealous with assert(fPruneMode != PruneMode::UNKNOWN.

fHavePruned is unknown during ParameterInteraction methods, because it is loaded from block index db, the location of which could be set by a parameter. It might be more elegant to split the ParameterInteraction methods into before and after databases have been loaded. That might also help to avoid various remaining instances of gArgs.GetArg("-prune".

@Sjors Sjors changed the title Interpret absense of prune= as prune=1 if there are pruned blocks WIP: Interpret absense of prune= as prune=1 if there are pruned blocks Apr 20, 2018
@Sjors Sjors force-pushed the 2018/04/implicit_prune branch from 34b38ab to 7a65e3c Compare April 20, 2018 09:11
@Sjors Sjors changed the title WIP: Interpret absense of prune= as prune=1 if there are pruned blocks Interpret absense of prune= as prune=1 if there are pruned blocks Apr 20, 2018
@laanwj
Copy link
Member

laanwj commented Apr 24, 2018

I'm not entirely sure about this. Guessing values for options according to context has the drawback that the system becomes less transparent, harder to troubleshoot.

Also it's good to avoid IsArgSet as much as possible as it's not possible to re-set an argument back to unset state, even by clearing it.

It also seems a large code change for what feels like a small argument handling change.

And if we do this, should we do the same for txindex?

@jonasschnelli
Copy link
Contributor

@Sjors: can you elaborate a little bit the use case this solves?

Agree with @laanwj that other arguments would have the same problem (if we would agree it is a problem).
It seems that this adds unnecessary complexity.
I think the current behaviour of refusing to run pruned blockchains where prune= is not set is correct.

@Sjors
Copy link
Member Author

Sjors commented Apr 25, 2018

The problem I'm trying to solve here is being able to set prune= in QT (#13043) without causing errors if the user later launches bitcoind, or if the user resets their QT settings (at which point they'd get locked out).

Another approach could be to reinterpret prune=0 to mean "you can't prune now, but it's OK if things were pruned in the past (fHavePruned=true)".

A similar problem exists for txindex, but that's solved by #13033, which no longer wipes the transaction index if you launch with txindex=0.

@maflcko
Copy link
Member

maflcko commented May 9, 2018

Needs rebase if still relevant

@Sjors Sjors force-pushed the 2018/04/implicit_prune branch from 7a65e3c to c416d89 Compare May 15, 2018 11:03
@Sjors
Copy link
Member Author

Sjors commented May 15, 2018

Rebased.

I might make a separate PR with a different approach:

  1. interpret prune=0 as not allowing manual pruning, but not failing if chain is already pruned
  2. if -txindex or -rescan are set, check if chain was actually pruned and fail if so

I don't think that approach would require much less code, but it is perhaps more future proof, once txindex and rescan work (better) with pruned nodes.

@maflcko
Copy link
Member

maflcko commented May 30, 2018

Needs rebase due to merge of #13341

bool fPruneMode is replaced by an enum class to include an UNKNOWN state.
fHavePruned is used to set fPruneNode if argument is not explictly set.
@Sjors Sjors force-pushed the 2018/04/implicit_prune branch from c416d89 to fa90f1f Compare May 30, 2018 15:59
@Sjors
Copy link
Member Author

Sjors commented May 30, 2018

Rebased

laanwj added a commit that referenced this pull request Jun 11, 2018
cbede7d [qt] OptionsDialog: add prune setting (Sjors Provoost)

Pull request description:

  The default suggested value is 2 GB. Minimum is 1 GB (550 MB rounded up).

  When the user toggles this setting, a strong warning appears that undoing requires re-downloading the chain:

  <img width="478" alt="schermafbeelding 2018-05-15 om 12 35 24" src="https://user-images.githubusercontent.com/10217/40051858-7939cc20-583c-11e8-9120-327a75376732.png">

  Tooltip points out that actual disk usage can be higher. It's a bit vague on the "advanced features", because I'm assuming anyone who needs to use `-rescan` and `-txindex` will read the documentation, and a more detailed text would needlessly confuse everyone else.

  <img width="450" alt="schermafbeelding 2018-05-15 om 12 33 51" src="https://user-images.githubusercontent.com/10217/40051791-49d6156a-583c-11e8-97b9-7de6dfd8c481.png">

  The UI uses gigabytes for readability and easy of use. There is also no manual pruning UI (`prune=1`). The user will have to use `bitcoin.conf` for those things.

  Fixes #6461. When combined with #13029 the user, after pruning their node, can safely reset settings and/or use bitcoind without having to edit `bitcoin.conf`. However I don't think that's an essential prerequisite.

Tree-SHA512: e17aff276d7235fbd40796adb6431d430620788a753ee13bc064abd35d2edc4280a3d3cddc18e42b4e00edff13ed18fd4f2a966c6f0b43b689afd13673e0c4bf
@Sjors
Copy link
Member Author

Sjors commented Jul 6, 2018

Closing this because the rw_config approach in #11082 seems to have sufficient support.

@Sjors Sjors closed this Jul 6, 2018
@Sjors Sjors deleted the 2018/04/implicit_prune branch July 6, 2018 10:03
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants