BTCP-Rebase/src
Wladimir J. van der Laan 4366f61cc9
Merge #11862: Network specific conf sections
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)

Pull request description:

  The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:

      <cfields> an alternative to that would be sections in a config file. and on the
                cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.

  This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.

  The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.

  I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:

      wallet=/secret/wallet.dat
      upnp=1

  and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:

      upnp=1

      [main]
      wallet=/secret/wallet.dat

  For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.

  I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:

      maxmempool=200
      [regtest]
      maxmempool=100

  your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...

  The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.

  Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos

Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2018-04-16 20:52:38 +02:00
..
bench scripted-diff: Rename wallet database classes 2018-04-07 11:48:27 -05:00
compat Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
config
consensus Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
crypto Consensus: Fix bug when compiler do not support __builtin_clz* 2018-03-01 17:20:27 +08:00
interfaces Merge #11200: Allow for aborting rescans in the GUI 2018-04-13 20:51:59 +02:00
leveldb Bump leveldb subtree 2018-02-16 08:59:28 -05:00
obj
obj-test
policy Extract consts for WITNESS_V0 hash sizes 2018-04-10 20:13:32 -07:00
primitives Support serialization as another type without casting 2018-03-20 17:08:06 -07:00
qt Merge #11200: Allow for aborting rescans in the GUI 2018-04-13 20:51:59 +02:00
rpc Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/mining 2018-04-12 18:25:44 -07:00
script Drop dead code CScript::Find 2018-04-12 18:57:23 -07:00
secp256k1 Bump secp256k1 subtree 2017-09-29 16:02:39 +02:00
support Remove duplicate includes 2018-04-09 09:18:49 +02:00
test Merge #11862: Network specific conf sections 2018-04-16 20:52:38 +02:00
univalue univalue: Bump subtree 2018-02-10 09:55:54 -05:00
wallet Merge #11200: Allow for aborting rescans in the GUI 2018-04-13 20:51:59 +02:00
zmq Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
.clang-format
Makefile.am Merge #12886: Introduce Span type and use it instead of FLATDATA 2018-04-08 18:13:49 +02:00
Makefile.bench.include Add new prevector benchmarks. 2018-02-27 11:42:06 -08:00
Makefile.leveldb.include
Makefile.qt.include Remove direct bitcoin calls from qt/splashscreen.cpp 2018-04-04 16:52:40 -04:00
Makefile.qttest.include Remove direct bitcoin calls from qt/splashscreen.cpp 2018-04-04 16:52:40 -04:00
Makefile.test.include Merge #12926: Run unit tests in parallel 2018-04-10 14:27:18 +02:00
addrdb.cpp Add native support for serializing char arrays without FLATDATA 2018-03-21 14:14:04 -07:00
addrdb.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
addrman.cpp net: Correct addrman logging 2018-03-06 21:52:53 +01:00
addrman.h Merge #12731: Support serialization as another type without casting 2018-04-10 20:54:33 +02:00
amount.h
arith_uint256.cpp [arith_uint256] Do not destroy *this content if passed-in operator may reference it 2018-03-01 11:49:35 +09:00
arith_uint256.h [arith_uint256] Avoid unnecessary this-copy using prefix operator 2018-02-28 19:59:19 +09:00
base58.cpp use base58 map instead of strchr() 2018-03-21 11:57:57 +08:00
base58.h Split key_io (address/key encodings) off from base58 2018-02-19 18:55:21 -08:00
bech32.cpp scripted-diff: Replace #include "" with #include <> (ryanofsky) 2017-11-16 08:23:01 +13:00
bech32.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
bitcoin-cli-res.rc
bitcoin-cli.cpp Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName 2018-04-06 04:46:02 +10:00
bitcoin-tx-res.rc
bitcoin-tx.cpp Merge #12950: bitcoin-tx: Flatten for loop over one element 2018-04-13 17:15:15 +02:00
bitcoind-res.rc
bitcoind.cpp Ignore macOS daemon() depracation warning 2018-04-11 10:19:44 +02:00
blockencodings.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
blockencodings.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
bloom.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
bloom.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
chain.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
chain.h Add static_assert to prevent VARINT(<signed value>) 2018-03-15 18:57:55 -05:00
chainparams.cpp Remove duplicate includes 2018-04-09 09:18:49 +02:00
chainparams.h Disable wallet fallbackfee by default on mainnet 2018-02-25 09:33:46 +08:00
chainparamsbase.cpp ArgsManager: support config file sections 2018-04-11 23:15:28 +10:00
chainparamsbase.h Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName 2018-04-06 04:46:02 +10:00
chainparamsseeds.h Fix a-vs-an typos 2018-02-11 10:48:15 +01:00
checkpoints.cpp Add LookupBlockIndex function 2018-03-06 19:52:19 +00:00
checkpoints.h Add LookupBlockIndex function 2018-03-06 19:52:19 +00:00
checkqueue.h [Refactor] Remove unused fQuit var from checkqueue.h 2018-01-07 20:44:21 +00:00
clientversion.cpp Merge #11966: clientversion: Use full commit hash for commit-based version descriptions 2018-02-13 10:58:41 +01:00
clientversion.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
coins.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
coins.h Support deserializing into temporaries 2018-03-13 17:04:31 -07:00
compat.h Add new prevector benchmarks. 2018-02-27 11:42:06 -08:00
compressor.cpp Move compressor utility functions out of class 2018-03-21 14:17:18 -07:00
compressor.h Support serializing Span<unsigned char> and use that instead of FLATDATA 2018-04-05 08:20:37 -07:00
core_io.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
core_memusage.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
core_read.cpp Merge #10498: Use static_cast instead of C-style casts for non-fundamental types 2018-02-07 16:15:28 -05:00
core_write.cpp Fix typos 2018-03-21 08:34:44 +02:00
cuckoocache.h Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion 2018-03-27 00:37:20 +02:00
dbwrapper.cpp [logging] Comment all continuing logs. 2018-04-07 12:29:48 -04:00
dbwrapper.h Add DynamicMemoryUsage() to LevelDB 2018-03-06 00:25:39 -05:00
fs.cpp scripted-diff: Replace #include "" with #include <> (ryanofsky) 2017-11-16 08:23:01 +13:00
fs.h
hash.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
hash.h Support deserializing into temporaries 2018-03-13 17:04:31 -07:00
httprpc.cpp Merge #12859: Bugfix: Include <memory> for std::unique_ptr 2018-04-05 09:31:53 +02:00
httprpc.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
httpserver.cpp Merge #12859: Bugfix: Include <memory> for std::unique_ptr 2018-04-05 09:31:53 +02:00
httpserver.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
indirectmap.h
init.cpp Merge #11862: Network specific conf sections 2018-04-16 20:52:38 +02:00
init.h wallet: Refactor to WalletInitInterface* const g_wallet_init_interface 2018-04-05 21:09:22 +01:00
key.cpp Merge #9598: Improve readability by removing redundant casts to same type (on all platforms) 2018-03-07 17:47:46 +01:00
key.h Make CKey::Load references const 2018-01-23 13:16:56 -05:00
key_io.cpp Simplify Base32 and Base64 conversions 2018-03-07 07:04:07 -08:00
key_io.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
keystore.cpp Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size 2018-04-04 17:50:32 -04:00
keystore.h Merge #12762: Make CKeyStore an interface 2018-03-27 20:42:49 +02:00
limitedmap.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
memusage.h Bugfix: Include <memory> for std::unique_ptr 2018-04-02 18:31:52 +00:00
merkleblock.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
merkleblock.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
miner.cpp Remove duplicate includes 2018-04-09 09:18:49 +02:00
miner.h Remove unused variable in SortForBlock 2018-03-14 23:10:39 -07:00
net.cpp correcting the array name from pnSeeds6 to pnSeed6 2018-04-14 16:19:40 -07:00
net.h Merge #12569: net: Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s 2018-04-13 19:25:18 +02:00
net_processing.cpp Merge #12859: Bugfix: Include <memory> for std::unique_ptr 2018-04-05 09:31:53 +02:00
net_processing.h Remove direct bitcoin calls from qt/peertablemodel.cpp 2018-04-04 16:52:40 -04:00
netaddress.cpp Merge #10498: Use static_cast instead of C-style casts for non-fundamental types 2018-02-07 16:15:28 -05:00
netaddress.h Introduce BigEndian wrapper and use it for netaddress ports 2018-04-08 15:31:01 -07:00
netbase.cpp Merge #12569: net: Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s 2018-04-13 19:25:18 +02:00
netbase.h Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s 2018-03-11 10:49:04 +01:00
netmessagemaker.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
noui.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
noui.h
pow.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
pow.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
prevector.h Use memset() to optimize prevector::resize() 2018-02-27 13:27:51 -08:00
protocol.cpp Add setter for g_initial_block_download_completed 2018-02-17 21:28:50 +11:00
protocol.h Merge #12731: Support serialization as another type without casting 2018-04-10 20:54:33 +02:00
pubkey.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
pubkey.h Assert CPubKey::ValidLength to the pubkey's header-relevent size 2018-02-16 12:30:26 -08:00
random.cpp Remove duplicate includes 2018-04-09 09:18:49 +02:00
random.h Merge #12742: Make FastRandomContext support standard C++11 RNG interface 2018-03-22 12:21:46 -04:00
rest.cpp Merge #12717: [REST] Handle UTXO retrieval when ignoring the mempool 2018-03-27 21:32:02 +02:00
reverse_iterator.h Declare single-argument (non-converting) constructors "explicit" 2017-08-16 16:33:25 +02:00
reverselock.h
scheduler.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
scheduler.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
serialize.h Merge #12916: Introduce BigEndian wrapper and use it for netaddress ports 2018-04-11 14:23:58 +02:00
span.h Add Slice: a (pointer, size) array view that acts like a container 2018-04-05 08:20:37 -07:00
streams.h Support deserializing into temporaries 2018-03-13 17:04:31 -07:00
sync.cpp [logging] Comment all continuing logs. 2018-04-07 12:29:48 -04:00
sync.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
threadinterrupt.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
threadinterrupt.h
threadsafety.h
timedata.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
timedata.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
tinyformat.h Fix typos 2018-03-21 08:34:44 +02:00
torcontrol.cpp boost: drop boost threads from torcontrol 2018-02-08 14:35:29 -05:00
torcontrol.h boost: drop boost threads from torcontrol 2018-02-08 14:35:29 -05:00
txdb.cpp [logging] Comment all continuing logs. 2018-04-07 12:29:48 -04:00
txdb.h Merge #12731: Support serialization as another type without casting 2018-04-10 20:54:33 +02:00
txmempool.cpp Merge #11742: rpc: Add testmempoolaccept 2018-04-02 16:02:33 +02:00
txmempool.h Merge #11742: rpc: Add testmempoolaccept 2018-04-02 16:02:33 +02:00
ui_interface.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
ui_interface.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
uint256.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
uint256.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
undo.h Merge #12716: Fix typos and cleanup in various files 2018-03-21 11:17:43 -04:00
util.cpp ArgsManager: special handling for -regtest and -testnet 2018-04-11 23:15:28 +10:00
util.h Merge #11862: Network specific conf sections 2018-04-16 20:52:38 +02:00
utilmoneystr.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
utilmoneystr.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
utilstrencodings.cpp Simplify Base32 and Base64 conversions 2018-03-07 07:04:07 -08:00
utilstrencodings.h Generalize ConvertBits 2018-03-06 20:28:08 -08:00
utiltime.cpp Avoid std::locale/imbue in DateTimeStrFormat 2018-04-13 01:36:53 -07:00
utiltime.h Avoid std::locale/imbue in DateTimeStrFormat 2018-04-13 01:36:53 -07:00
validation.cpp Merge #12951: [doc] Fix comment in FindForkInGlobalIndex 2018-04-16 08:38:28 +02:00
validation.h Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/mining 2018-04-12 18:25:44 -07:00
validationinterface.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
validationinterface.h Polish interfaces around PeerLogicValidation 2018-03-14 10:11:01 +01:00
version.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
versionbits.cpp scripted-diff: Convert 11 enums into scoped enums (C++11) 2018-03-09 15:03:40 +01:00
versionbits.h Merge #12757: Clarify include guard naming convention 2018-04-01 18:30:21 -04:00
walletinitinterface.h wallet: Make WalletInitInterface and DummyWalletInit private 2018-04-05 21:09:21 +01:00
warnings.cpp Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
warnings.h Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00