HomePhabricator

util: make GetDataDir read-only & create datadir only in bitcoind and bitcoin-qt

Description

util: make GetDataDir read-only & create datadir only in bitcoind and bitcoin-qt

Summary:
Currently ArgsManager::GetDataDir() ensures it will always return a datadir by creating one if necessary. The function is shared between bitcoind bitcoin-qt and bitcoin-cli which results in the undesirable behaviour described in core#20070.

This PR splits out the part of the function which creates directories and adds it as a standalone function, only called as part of bitcoind and bitcoin-qt init, but not bitcoin-cli.

This changes behaviour of GetConfigFilePath which now always returns the
absolute path of the provided -conf argument.

This is a backport of core#27073

Depends on D16192

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16193

Details

Provenance
willcl-ark <will@256k1.dev>Authored on Feb 9 2023, 14:42
PiRKCommitted on May 22 2024, 05:48
PiRKPushed on May 22 2024, 05:48
Reviewer
Restricted Project
Differential Revision
D16193: util: make GetDataDir read-only & create datadir only in bitcoind and bitcoin-qt
Parents
rABC62f6ad9702ad: gui: Prompt to reset settings when settings.json cannot be read
Branches
Unknown
Tags
Unknown