Skip to content

Conversation

@random-zebra
Copy link

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:

    main.uacomment=pivx
    test.uacomment=pivx-testnet
    regtest.uacomment=regtest
    [main]
    mempoolsize=300
    [test]
    mempoolsize=100
    [regtest]
    mempoolsize=20

The addnode=, connect=, port=, bind=, rpcport=, rpcbind=, and wallet= options will only apply to mainnet when specified in the configuration file, unless a network is specified.

Also

  • fix cookie-based authentication for the functional tests, and re-enable feature_config_args.py
  • add -rpcauth startup flag, for multiple RPC users, and re-enable rpc_users.py.

Backports relevant commits from:

random-zebra and others added 25 commits April 19, 2021 23:41
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.
@random-zebra random-zebra added this to the 6.0.0 milestone Apr 19, 2021
@random-zebra random-zebra self-assigned this Apr 19, 2021
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a 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

Copy link

@furszy furszy left a 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded change: pivx.conf

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already fixed in 23a4633, and then removed in 2658771

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string bitcoind -> pivxd

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already fixed in 2658771

@furszy furszy merged commit 0255df3 into PIVX-Project:master Apr 26, 2021
furszy added a commit that referenced this pull request Apr 30, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants