[Config] Ignore prune mode if txindex is set #874
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#253 - Prune mode incompatible with txindex.
Having prune mode on can stick the user into being unable to start their wallet. For Qt: they receive an error stating "Prune mode is Incompatible with -txindex"
Root Cause
The error was a little heavy handed, and rejected the use of prune mode without txindex=0. The part of this issue that makes it important to address is that you can inadvertently end up with bPrune set in your registry on windows; making it difficult to find and remove. There is an additional issue that implies that uninstalling your wallet will not remove the registry entries; so getting bPrune=true in your registry would be quite challenging to clear out, and likely result in support tickets.
Solution
Note that prune mode is unsupported and likely will result in corrupting your wallet. This is not meant to claim that prune mode is functional.
If Prune mode is set and txindex is not implicitly disabled [txindex=0], the wallet will not run. This PR changes the prune mode from an error that shuts down the wallet, to a warning that ignores prune mode if txindex is enabled. This warning will not show in a Windows pop-up, but rather in the log file and the terminal executing the daemon and/or qt. It will also ignore the prune mode setting, changing it to '0' if it is set.
Testing
combinations of txindex=[0|1], prune=[0|1] in your config file, command line, and bPrune=true in your registry [see issue #253 for registry details]