Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pruning keeps getting reenabled #709

Open
hebasto opened this issue Feb 7, 2023 · 2 comments
Open

Pruning keeps getting reenabled #709

hebasto opened this issue Feb 7, 2023 · 2 comments
Labels
Bug Something isn't working

Comments

@hebasto
Copy link
Member

hebasto commented Feb 7, 2023

Expected behavior

I want my Bitcoin Core node to never prune the blockchain.

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.

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).

System information

Bitcoin Core 0.20.0 macOS GUI version. Downloaded from https://bitcoincore.org/.

macOS Catalina 10.15.5.

Contents of /Volume/Drive/Bitcoin/bitcoin.conf:

server=1
dbcache=4096
rpcport=8332
prune=0

Moved from bitcoin/bitcoin#19291.

@hebasto hebasto added the Bug Something isn't working label Feb 7, 2023
@BenWestgate
Copy link
Contributor

Hi hebasto, a work around would be to put a bitcoin.conf file in /Volumes/Drive/Bitcoin with prune=0 BEFORE mounting your external drive, that way if it hasn't been mounted Bitcoin Core will not try to prune. This file will be buried and ignored after your external drive mounts.

Another work around would be adding -prune=0 to whatever method you are launching Bitcoin, be that command line or a .desktop file.

The file that remembers where your custom datadir is $HOME/.config/Bitcoin/Bitcoin-Qt.conf on linux.

Setting prune=0 in there however will be ignored on first launch, unfortunately this is probably a bug, since it DOESN'T ignore the datadir= entry.

The Welcome GUI overrides everything except the bitcoin.conf of the chosen datadir and the command line parameters. But it doesn't read the bitcoin.conf to know the prune setting to use until after the datadir is selected.

So the checkbox about pruning in that welcome screen will ONLY reflect the command line -prune=0 option given to bitcoin-qt.

You might also make the mount point read only after putting a bitcoin.conf in there then bitcoin will error out if your External Storage has not been mounted.

@BenWestgate
Copy link
Contributor

Letting Bitcoin-Qt search for bitcoin.conf in $XDG_CONFIG_HOME/Bitcoin and reading it from your internal drive if present would resolve this issue. As is, bitcoin.conf is not read until after that choosedatadir window is dismissed.
bitcoin/bitcoin#16733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants