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 should be based on bitcoin.conf #245

Closed
ghost opened this issue Mar 12, 2021 · 9 comments
Closed

Pruning should be based on bitcoin.conf #245

ghost opened this issue Mar 12, 2021 · 9 comments
Labels
Bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 12, 2021

image

Its mentioned that options set in GUI will be overridden by the configuration file. I had nothing for mainnet in bitcoin.conf, removed testnet=1 and prune=555 for testnet, saved new datadir path for external drive that had mainnet synced.

I launched bitcoin-qt assuming it will not prune anything because there is nothing mentioned in bitcoin.conf, it deleted all my data and pruning was done based on GUI options which had 2 GB saved either by default or maybe I saved it in past.

Expected behavior

If bitcoin.conf does not mention anything about pruning it should not prune. If GUI for mainnet had pruning enabled in GUI, it should be saved automatically in bitcoin.conf as well to avoid the confusion and things remain in sync.

Actual behavior

Pruning is done based on GUI options

To reproduce

Sync a full node. Maybe testnet which will take less time.

Use the blocks and chainstate in other node (which had pruning enabled in GUI) using datadir and bitcoin.conf doesn't have anything else.

Launch bitcoin-qt

System information

Bitcoin Core v 0.21.0. Ubuntu 20.04.2 LTS.

@ghost ghost added the Bug Something isn't working label Mar 12, 2021
@ghost ghost changed the title Pruning should be done based on bitcoin.conf Pruning should be based on bitcoin.conf Mar 12, 2021
@hebasto
Copy link
Member

hebasto commented Mar 12, 2021

@prayank23

If GUI for mainnet had pruning enabled in GUI, it should be saved automatically in bitcoin.conf as well to avoid the confusion and things remain in sync.

It is a common consensus that, for safety, the opposite seems correct. From doc/files.md:

File is not written to by the software and must be created manually.

@ghost
Copy link
Author

ghost commented Mar 12, 2021

@hebasto How about adding a confirmation window before this pruning begins based on GUI settings? If user clicks YES, prune based on GUI settings. If user clicks NO, do not prune based on GUI settings and disable pruning.

This confirmation can be triggered if pruning is enabled in GUI settings and not found in bitcoin.conf during splash screen.

@ghost
Copy link
Author

ghost commented Mar 15, 2021

It works fine if I comment this line and launch bitcoin-qt

gui/src/init.cpp

Line 1830 in 6bc51af

chainstate->PruneAndFlush();

@rebroad
Copy link
Contributor

rebroad commented Apr 26, 2021

It works fine if I comment this line and launch bitcoin-qt

gui/src/init.cpp

Line 1830 in 6bc51af

chainstate->PruneAndFlush();

so, a one-line fix?

@ghost
Copy link
Author

ghost commented Apr 26, 2021

so, a one-line fix?

I am not sure why this line exists and if removing this will break something else.

@Rspigler
Copy link
Contributor

I launched bitcoin-qt assuming it will not prune anything because there is nothing mentioned in bitcoin.conf

It should not prune if you set prune=0 in the config file. But having nothing in the config file is not the same as stating Do Not Prune. Configuration file should override GUI settings

@ghost
Copy link
Author

ghost commented Apr 27, 2021

It should not prune if you set prune=0 in the config file.

Interesting. I think I will close this issue for now but this problem needs a better solution because if a software is deleting such important data for user, there needs to be atleast some warning or confirmation message.

@ghost ghost closed this as completed Apr 27, 2021
@hebasto
Copy link
Member

hebasto commented Apr 27, 2021

Configuration file should override GUI settings

More info: doc/bitcoin-conf.md

@Alex20129
Copy link

It should not prune if you set prune=0 in the config file. But having nothing in the config file is not the same as stating Do Not Prune. Configuration file should override GUI settings

Having nothing in the config file is the same as having "prune=[defaultValue]". I assume, "defaultValue" = "0" in this case, because we talking about days of waiting and hundreds of gigabytes of data, which was downloaded for reasons.

@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jan 25, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants