-
Notifications
You must be signed in to change notification settings - Fork 725
[Core] Network specific configuration sections #2324
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
[Core] Network specific configuration sections #2324
Conversation
When a -nofoo option is seen, instead of adding it to a separate set of negated args, set the arg as being an empty vector of strings. This changes the behaviour in some ways: - -nofoo=0 still sets foo=1 but no longer treats it as a negated arg - -nofoo=1 -foo=2 has GetArgs() return [2] rather than [2,0] - "foo=2 \n -nofoo=1" in a config file no longer returns [2,0], just [0] - GetArgs returns an empty vector for negated args
>>> backports bitcoin/bitcoin@1c80386 Base64 contains '/', and the '/' character in credentials is problematic for AuthServiceProxy which represents the RPC endpoint as an URI with user and password embedded.
>>> adapted from bitcoin/bitcoin@c53c983 Since rpcuser and rpcpassword are now deprecated, replace them with cookie auth. Fix test failures with cookie auth
This was added way back in btc#7044. Adapted here to btc v0.16 code
section When specified in bitcoin.conf without using the [regtest] or [test] section header, or a "regtest." or "test." prefix, the "addnode", "connect", "port", "bind", "rpcport", "rpcbind", and "wallet" settings will only be applied when running on mainnet.
When network-specific options such as -addnode, -connect, etc are specified in the default section of the config file, but that setting is ignored due to testnet or regtest being in use, and it is not overridden by either a command line option or a setting in the [regtest] or [test] section of the config file, a warning is added to the log, eg: Warning: Config setting for -connect only applied on regtest network when in [regtest] section.
Fuzzbawls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great set of backports here!
Tested ACK 8817d76
furszy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 8817d76
This will be useful. Only left two tiny nits that we can tackle later.
src/util.cpp
Outdated
| for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it) { | ||
| // Don't overwrite existing settings so command line settings override pivx.conf | ||
| for (boost::program_options::detail::config_file_iterator it(stream, setOptions), end; it != end; ++it) { | ||
| // Don't overwrite existing settings so command line settings override bitcoin.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded change: pivx.conf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/util.cpp
Outdated
| std::pair<bool,std::string> found_result(false, std::string()); | ||
|
|
||
| // We pass "true" to GetArgHelper in order to return the last | ||
| // argument value seen from the command line (so "bitcoind -foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string bitcoind -> pivxd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already fixed in 2658771
be6563a Remove program options from build systems (Fuzzbawls) 025b8c2 Replace boost program_options (Fuzzbawls) Pull request description: Follow-up to #2324 which backports bitcoin#13482 This removes the dependency on Boost's program_options module ACKs for top commit: random-zebra: utACK be6563a furszy: utACK be6563a and merging Tree-SHA512: 6b1550e20c0bb6b3ec16659b181724cf72f02c7c00b584bdfabe06b77feeea249910e073393775f47499dfa0a7fb9137d952e8ad9f78df0ff03cc9b5a8e1c96b
It is now possible for a single configuration file to set different options for different networks. This is done by using sections or by prefixing the option with the network, such as:
The
addnode=,connect=,port=,bind=,rpcport=,rpcbind=, andwallet=options will only apply to mainnet when specified in the configuration file, unless a network is specified.Also
feature_config_args.py-rpcauthstartup flag, for multiple RPC users, and re-enablerpc_users.py.Backports relevant commits from: