HomePhabricator

Don't allow relative -walletdir paths

Description

Don't allow relative -walletdir paths

Summary:
Also warn if bitcoind is configured to use a relative -datadir path.

Specifying paths relative to the current working directory in a daemon
process can be dangerous, because files can fail to be located even if
the configuration doesn't change, but the daemon is started up
differently.

Specifying a relative -datadir now adds a warning to the debug log. It
would not be backwards-compatible to forbid relative -datadir paths
entirely, and it could also be also inconvenient for command line
testing.

Specifying a relative -walletdir now results in a startup error. But
since the -walletdir option is new in 0.18.7, there should be no
compatibility issues.
Another reason not to use working directory paths for -walletdir
specifically is that the default -walletdir is a "wallets" subdirectory
inside the datadir, so it could be surprising that setting -walletdir
manually would choose a directory rooted in a completely different
location.

Backport of core PR12220

Depends on D2400

Test Plan:

make check
./test/functional/test_runner.py wallet_multiwallet

mkdir mydata
./src/bitcoind -datadir=mydata

Check in the log for a warning:

Warning: relative datadir option 'mydata' specified, which will be

interpreted relative to the current working directory

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: teamcity, schancel

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

Details

Provenance
Russell Yanofsky <russ@yanofsky.org>Authored on Jan 18 2018, 18:15
FabienCommitted on Jan 24 2019, 17:15
FabienPushed on Jan 24 2019, 17:46
Reviewer
Restricted Project
Differential Revision
D2407: Don't allow relative -walletdir paths
Parents
rSTAGINGe6d1f16f8b74: Allow multiwallet.py to be used with --usecli
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/6931, tag: phabricator/base/6927, tag: phabricator/base/6924