<!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->
<!-- Describe the issue -->
Expected behavior
I want my Bitcoin Core node to never prune the blockchain.
<!--- What behavior did you expect? -->
Actual behavior
Occasionally, Bitcoin Core will enable the pruning option. This causes it to prune the blockchain, and forces me to resync when I disable it. I started seeing this in 0.19 and it still persists in 0.20. It may also be related to my moving to a new computer which upgraded me to Catalina. I'm not really sure.
<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->
To reproduce
I think it might be related to the fact that my data directory is on an external hard drive. If I start Bitcoin Core before mounting in the drive, it will popup the dialog as if it is my first time starting Bitcoin Core, asking me where to store the block chain. In the dialog, the datadir location is defaulted to put it in the location where my external hard drive mount would be, like /Volumes/Drive/Bitcoin. If I then mount the drive and choose next in the dialog, the sync works, but pruning is enabled and it immediately prunes the blockchain. I can go into the settings at this point and uncheck pruning, but at that point, it requires a full resync. And it ends up being enabled again the next time I start Bitcoin Core. Needless to say, this is extremely annoying and makes Bitcoin Core almost unusable for me.
I even tried setting prune=0 in my bitcoin.conf file, which is on the external drive, but it has no effect.
I suspect what is happening is that pruning is enabled by default, and since it can't find my datadir when it launches, Bitcoin Core thinks that it is doing a fresh sync and sets it to true. This setting is then not updated, even from the bitcoin.conf (which itself lives on the external drive) once that datadir is loaded. The fact that it remembers where the datadir is implies that some settings are stored locally, though I can't really tell where. Is it possible for me to store my no-prune setting locally as well?
Note that I used to do this exact workflow of opening Bitcoin Core before mounting my drive all the time in previous node versions and macOS versions, and it never enabled pruning on me.
(as an aside, I feel like Bitcoin Core should be smart enough to recognize that a datadir in /Volumes on macOS is an external drive, even when it doesn't currently exist).
<!--- How reliably can you reproduce the issue, what are the steps to do so? -->
System information
<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->
Bitcoin Core 0.20.0 macOS GUI version. Downloaded from https://bitcoincore.org/.
<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->
macOS Catalina 10.15.5.
<!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->
<!-- Any extra information that might be useful in the debugging process. -->
<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->
Contents of /Volume/Drive/Bitcoin/bitcoin.conf:
server=1
dbcache=4096
rpcport=8332
prune=0