From be55f545d53d44fdcf2d8ae802e9eae551d120c6 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Thu, 23 Mar 2023 12:23:29 +0100 Subject: move-only: Extract common/args and common/config.cpp from util/system This is an extraction of ArgsManager related functions from util/system into their own common file. Config file related functions are moved to common/config.cpp. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager. The ArgsManager belongs into the common library, since the kernel library should not depend on it. See doc/design/libraries.md for more information on this rationale. --- src/Makefile.am | 5 + src/addrdb.cpp | 2 +- src/banman.cpp | 1 + src/bench/bench_bitcoin.cpp | 2 +- src/bench/checkblock.cpp | 2 +- src/bitcoin-chainstate.cpp | 2 +- src/bitcoin-cli.cpp | 4 +- src/bitcoin-tx.cpp | 1 + src/bitcoin-util.cpp | 1 + src/bitcoin-wallet.cpp | 3 +- src/bitcoind.cpp | 3 +- src/chainparams.cpp | 3 +- src/chainparamsbase.cpp | 2 +- src/common/args.cpp | 823 +++++++++++++++++++ src/common/args.h | 465 +++++++++++ src/common/config.cpp | 220 +++++ src/common/init.cpp | 2 +- src/dummywallet.cpp | 3 +- src/httprpc.cpp | 3 +- src/httpserver.cpp | 3 +- src/i2p.cpp | 2 +- src/index/base.cpp | 2 +- src/index/blockfilterindex.cpp | 2 +- src/index/coinstatsindex.cpp | 2 +- src/index/txindex.cpp | 2 +- src/init.cpp | 1 + src/init/bitcoin-gui.cpp | 2 +- src/init/bitcoin-node.cpp | 2 +- src/init/bitcoin-qt.cpp | 2 +- src/init/bitcoind.cpp | 2 +- src/init/common.cpp | 2 +- src/net.cpp | 2 +- src/net_processing.cpp | 2 +- src/node/blockmanager_args.cpp | 2 +- src/node/blockstorage.cpp | 3 +- src/node/caches.cpp | 2 +- src/node/chainstatemanager_args.cpp | 2 +- src/node/coins_view_args.cpp | 2 +- src/node/database_args.cpp | 2 +- src/node/interfaces.cpp | 2 +- src/node/mempool_args.cpp | 2 +- src/node/mempool_persist_args.cpp | 2 +- src/node/miner.cpp | 2 +- src/node/txreconciliation.cpp | 1 + src/node/utxo_snapshot.cpp | 2 +- src/node/validation_cache_args.cpp | 2 +- src/policy/fees_args.cpp | 2 +- src/protocol.cpp | 2 + src/qt/bitcoin.cpp | 3 +- src/qt/clientmodel.cpp | 1 + src/qt/guiutil.cpp | 3 +- src/qt/intro.cpp | 2 +- src/qt/optionsmodel.cpp | 6 +- src/qt/paymentserver.cpp | 2 +- src/qt/test/optiontests.cpp | 2 +- src/qt/utilitydialog.cpp | 2 +- src/qt/walletmodel.cpp | 2 +- src/rpc/blockchain.cpp | 2 +- src/rpc/client.cpp | 2 +- src/rpc/external_signer.cpp | 4 +- src/rpc/request.cpp | 3 +- src/rpc/server.cpp | 2 + src/rpc/server_util.cpp | 1 + src/rpc/util.cpp | 2 +- src/script/descriptor.cpp | 2 +- src/script/sigcache.cpp | 1 + src/signet.cpp | 5 +- src/test/argsman_tests.cpp | 2 +- src/test/checkqueue_tests.cpp | 2 +- src/test/denialofservice_tests.cpp | 2 +- src/test/flatfile_tests.cpp | 2 +- src/test/fuzz/addrman.cpp | 2 +- src/test/fuzz/banman.cpp | 2 +- src/test/fuzz/connman.cpp | 2 +- src/test/fuzz/deserialize.cpp | 2 +- src/test/fuzz/i2p.cpp | 2 +- src/test/fuzz/integer.cpp | 1 + src/test/fuzz/string.cpp | 1 + src/test/fuzz/system.cpp | 2 +- src/test/fuzz/versionbits.cpp | 2 +- src/test/getarg_tests.cpp | 3 +- src/test/i2p_tests.cpp | 2 +- src/test/net_tests.cpp | 2 +- src/test/random_tests.cpp | 1 + src/test/settings_tests.cpp | 2 +- src/test/util/setup_common.cpp | 1 + src/test/util/setup_common.h | 2 +- src/test/validationinterface_tests.cpp | 2 + src/timedata.cpp | 3 +- src/torcontrol.cpp | 3 +- src/txmempool.cpp | 1 + src/util/system.cpp | 1018 +----------------------- src/util/system.h | 444 ----------- src/validation.cpp | 1 + src/wallet/bdb.cpp | 3 + src/wallet/bdb.h | 1 + src/wallet/coincontrol.cpp | 2 +- src/wallet/coinselection.cpp | 3 +- src/wallet/db.cpp | 2 +- src/wallet/dump.cpp | 2 +- src/wallet/external_signer_scriptpubkeyman.cpp | 2 + src/wallet/init.cpp | 2 +- src/wallet/interfaces.cpp | 2 +- src/wallet/load.cpp | 2 +- src/wallet/spend.cpp | 2 + src/wallet/test/init_test_fixture.cpp | 2 +- src/wallet/test/init_tests.cpp | 2 +- src/wallet/wallet.cpp | 2 +- src/wallet/wallettool.cpp | 2 +- src/wallet/walletutil.cpp | 2 +- src/zmq/zmqnotificationinterface.cpp | 2 +- 111 files changed, 1652 insertions(+), 1544 deletions(-) create mode 100644 src/common/args.cpp create mode 100644 src/common/args.h create mode 100644 src/common/config.cpp (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 444480f824..39c406b212 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -133,6 +133,7 @@ BITCOIN_CORE_H = \ checkqueue.h \ clientversion.h \ coins.h \ + common/args.h \ common/bloom.h \ common/init.h \ common/run_command.h \ @@ -646,7 +647,9 @@ libbitcoin_common_a_SOURCES = \ bech32.cpp \ chainparams.cpp \ coins.cpp \ + common/args.cpp \ common/bloom.cpp \ + common/config.cpp \ common/init.cpp \ common/interfaces.cpp \ common/run_command.cpp \ @@ -901,6 +904,8 @@ libbitcoinkernel_la_SOURCES = \ chainparams.cpp \ clientversion.cpp \ coins.cpp \ + common/args.cpp \ + common/config.cpp \ compressor.cpp \ consensus/merkle.cpp \ consensus/tx_check.cpp \ diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 8ecccd4d22..b679ad0602 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include namespace { diff --git a/src/banman.cpp b/src/banman.cpp index ece949d997..5b2049d654 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -5,6 +5,7 @@ #include +#include #include #include #include diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp index 7faaa1fb14..8c421c3fec 100644 --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -5,10 +5,10 @@ #include #include +#include #include #include #include -#include #include #include diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index ee76f7b767..260c8991ce 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -6,9 +6,9 @@ #include #include +#include #include #include -#include #include // These are the two major time-sinks which happen after we have fully received diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index abe3af70c3..04f6aae4f7 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -24,7 +25,6 @@ #include #include #include