Repository navigation
util: Treat empty settings.json file as valid - #23096
AaronDewes wants to merge 2 commits into
Conversation
Previously, if the settings.json file was empty, it failed to parse. Now, it is handled like non-existent, which should help avoid issues if - The user decides to empty it - The file gets saved improperly - The user touches it before starting Bitcoin Core
|
A zero size settings file is a corrupt settings file, not different from other corrupt files. If critical settings that affect security, privacy, or performance (tor settings, pruning settings, etc) have been configured it could be harmful to ignore corruption like nothing happened. For non interactive The current behavior may not be ideal if the error message is not clear about the problem and potential fixes, or if the GUI is not presenting enough options. It seems useful to do a good job handling this case because the settings file is one of the first files read on startup, and if it has a problem, it could be indication of other problems with the datadir. Maybe also the settings file could be written in a more robust way, like maybe it would help to add a sync call before renaming on write. But I don't think allowing corruption would be a good thing to do here. |
Previously, if the settings.json file was empty, it failed to parse.
Now, it is handled like non-existent, which should help avoid issues if