init: Error if ignored bitcoin.conf file is found
Summary:
Show an error on startup if a bitcoin datadir that is being used contains a
bitcoin.conf file that is ignored. There are two cases where this could
happen:
- One case reported in https://github.com/bitcoin/bitcoin/issues/27246#issuecomment-1470006043 happens when a bitcoin.conf file in the default datadir (e.g. $HOME/.bitcoin/bitcoin.conf) has a "datadir=/path" line that sets different datadir containing a second bitcoin.conf file. Currently the second bitcoin.conf file is ignored with no warning.
- Another way this could happen is if a -conf= command line argument points to a configuration file with a "datadir=/path" line and that specified path contains a bitcoin.conf file, which is currently ignored.
This change only adds an error message and doesn't change anything about way
settings are applied. It also doesn't trigger errors if there are redundant
-datadir or -conf settings pointing at the same configuration file, only if
they are pointing at different files and one file is being ignored.
This is a partial backport of core#27302
https://github.com/bitcoin/bitcoin/pull/27302/commits/3746f00be1b732a04976fc70cbb0661f97bbbd99
Depends on D18222
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D18223