diff --git a/src/Makefile.am b/src/Makefile.am index 0724e19a22da..e6684ec9c2ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -205,6 +205,7 @@ BITCOIN_CORE_H = \ coinjoin/util.h \ coinjoin/walletman.h \ coins.h \ + common/args.h \ common/bloom.h \ common/init.h \ common/run_command.h \ @@ -214,6 +215,8 @@ BITCOIN_CORE_H = \ compat/compat.h \ compat/cpuid.h \ compat/endian.h \ + common/settings.h \ + common/system.h \ compressor.h \ consensus/consensus.h \ consensus/tx_check.h \ @@ -308,6 +311,7 @@ BITCOIN_CORE_H = \ kernel/mempool_limits.h \ kernel/mempool_options.h \ kernel/mempool_persist.h \ + kernel/notifications_interface.h \ kernel/validation_cache_sizes.h \ key.h \ key_io.h \ @@ -370,6 +374,7 @@ BITCOIN_CORE_H = \ node/database_args.h \ node/eviction.h \ node/interface_ui.h \ + node/kernel_notifications.h \ node/mempool_args.h \ node/mempool_persist_args.h \ node/miner.h \ @@ -441,10 +446,13 @@ BITCOIN_CORE_H = \ txrequest.h \ undo.h \ unordered_lru_cache.h \ + util/any.h \ util/asmap.h \ + util/batchpriority.h \ util/bip32.h \ util/bitset.h \ util/bytevectorhash.h \ + util/chaintype.h \ util/check.h \ util/edge.h \ util/epochguard.h \ @@ -458,6 +466,7 @@ BITCOIN_CORE_H = \ util/hash_type.h \ util/hasher.h \ util/helpers.h \ + util/insert.h \ util/macros.h \ util/message.h \ util/moneystr.h \ @@ -467,14 +476,12 @@ BITCOIN_CORE_H = \ util/readwritefile.h \ util/result.h \ util/serfloat.h \ - util/settings.h \ util/sock.h \ util/spanparsing.h \ util/std23.h \ util/string.h \ util/subprocess.h \ util/syserror.h \ - util/system.h \ util/thread.h \ util/threadinterrupt.h \ util/threadnames.h \ @@ -654,6 +661,7 @@ libbitcoin_node_a_SOURCES = \ node/eviction.cpp \ node/interface_ui.cpp \ node/interfaces.cpp \ + node/kernel_notifications.cpp \ node/mempool_args.cpp \ node/mempool_persist_args.cpp \ node/miner.cpp \ @@ -999,10 +1007,14 @@ 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 \ + common/settings.cpp \ + common/system.cpp \ common/url.cpp \ compressor.cpp \ core_read.cpp \ @@ -1066,8 +1078,10 @@ libbitcoin_util_a_SOURCES = \ support/lockedpool.cpp \ sync.cpp \ util/asmap.cpp \ + util/batchpriority.cpp \ util/bip32.cpp \ util/bytevectorhash.cpp \ + util/chaintype.cpp \ util/check.cpp \ util/edge.cpp \ util/error.cpp \ @@ -1081,13 +1095,11 @@ libbitcoin_util_a_SOURCES = \ util/ranges_set.cpp \ util/readwritefile.cpp \ util/serfloat.cpp \ - util/settings.cpp \ util/sock.cpp \ util/spanparsing.cpp \ util/strencodings.cpp \ util/string.cpp \ util/syserror.cpp \ - util/system.cpp \ util/thread.cpp \ util/threadinterrupt.cpp \ util/threadnames.cpp \ @@ -1284,7 +1296,11 @@ libdashkernel_la_SOURCES = \ chainparamsbase.cpp \ clientversion.cpp \ coins.cpp \ + common/args.cpp \ common/bloom.cpp \ + common/config.cpp \ + common/settings.cpp \ + common/system.cpp \ compressor.cpp \ consensus/merkle.cpp \ consensus/tx_check.cpp \ @@ -1381,7 +1397,9 @@ libdashkernel_la_SOURCES = \ txdb.cpp \ txmempool.cpp \ uint256.cpp \ + util/batchpriority.cpp \ util/bytevectorhash.cpp \ + util/chaintype.cpp \ util/check.cpp \ util/exception.cpp \ util/fs.cpp \ @@ -1391,12 +1409,10 @@ libdashkernel_la_SOURCES = \ util/moneystr.cpp \ util/ranges_set.cpp \ util/serfloat.cpp \ - util/settings.cpp \ util/sock.cpp \ util/strencodings.cpp \ util/string.cpp \ util/syserror.cpp \ - util/system.cpp \ util/thread.cpp \ util/threadinterrupt.cpp \ util/threadnames.cpp \ diff --git a/src/active/masternode.cpp b/src/active/masternode.cpp index 7565c013e2a9..20561768e686 100644 --- a/src/active/masternode.cpp +++ b/src/active/masternode.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/addrdb.cpp b/src/addrdb.cpp index db476cc3f0b1..cac7c380f9f1 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -23,8 +24,6 @@ #include #include #include -#include -#include #include #include @@ -140,7 +139,7 @@ CBanDB::CBanDB(fs::path ban_list_path) bool CBanDB::Write(const banmap_t& banSet) { std::vector errors; - if (util::WriteSettings(m_banlist_json, {{JSON_KEY, BanMapToJson(banSet)}}, errors)) { + if (common::WriteSettings(m_banlist_json, {{JSON_KEY, BanMapToJson(banSet)}}, errors)) { return true; } @@ -160,10 +159,10 @@ bool CBanDB::Read(banmap_t& banSet) return false; } - std::map settings; + std::map settings; std::vector errors; - if (!util::ReadSettings(m_banlist_json, settings, errors)) { + if (!common::ReadSettings(m_banlist_json, settings, errors)) { for (const auto& err : errors) { LogPrintf("Cannot load banlist %s: %s\n", fs::PathToString(m_banlist_json), err); } diff --git a/src/banman.cpp b/src/banman.cpp index f1c0eac20fbd..a128c83324a0 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -5,10 +5,11 @@ #include +#include +#include #include #include #include -#include #include #include diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp index 38eb9e682014..785c98c87440 100644 --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -6,11 +6,11 @@ #include #include +#include #include #include #include #include -#include #include #include diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index a297fbea8363..f2130073dd14 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -6,10 +6,11 @@ #include #include +#include #include #include #include -#include +#include #include #include @@ -39,7 +40,7 @@ static void DeserializeAndCheckBlockTest(benchmark::Bench& bench) stream.write({&a, 1}); // Prevent compaction ArgsManager bench_args; - const auto chainParams = CreateChainParams(bench_args, CBaseChainParams::MAIN); + const auto chainParams = CreateChainParams(bench_args, ChainType::MAIN); // CheckBlock calls g_stats_client internally, we aren't using a testing setup // so we need to do this manually. We can use the stub interface for this. ::g_stats_client = std::make_unique(); diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp index bb71af945798..6379daf26792 100644 --- a/src/bench/checkqueue.cpp +++ b/src/bench/checkqueue.cpp @@ -4,11 +4,11 @@ #include #include +#include #include #include #include #include -#include #include diff --git a/src/bench/load_external.cpp b/src/bench/load_external.cpp index c99d6d0c7496..2ec7b8d59423 100644 --- a/src/bench/load_external.cpp +++ b/src/bench/load_external.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include /** @@ -22,7 +23,7 @@ */ static void LoadExternalBlockFile(benchmark::Bench& bench) { - const auto testing_setup{MakeNoLogFileContext(CBaseChainParams::MAIN)}; + const auto testing_setup{MakeNoLogFileContext(ChainType::MAIN)}; // Create a single block as in the blocks files (magic bytes, block size, // block data) as a stream object. diff --git a/src/bench/logging.cpp b/src/bench/logging.cpp index 9aedb26236df..c97c4e151b6b 100644 --- a/src/bench/logging.cpp +++ b/src/bench/logging.cpp @@ -5,6 +5,7 @@ #include #include #include +#include // All but 2 of the benchmarks should have roughly similar performance: // @@ -18,7 +19,7 @@ static void Logging(benchmark::Bench& bench, const std::vector& ext LogInstance().DisableCategory(BCLog::LogFlags::ALL); TestingSetup test_setup{ - CBaseChainParams::REGTEST, + ChainType::REGTEST, extra_args, }; diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp index 456885811416..827d36e60463 100644 --- a/src/bench/mempool_stress.cpp +++ b/src/bench/mempool_stress.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -86,7 +87,7 @@ static void ComplexMemPool(benchmark::Bench& bench) childTxs = static_cast(bench.complexityN()); } std::vector ordered_coins = CreateOrderedCoins(det_rand, childTxs, /*min_ancestors=*/1); - const auto testing_setup = MakeNoLogFileContext(CBaseChainParams::MAIN); + const auto testing_setup = MakeNoLogFileContext(ChainType::MAIN); CTxMemPool& pool = *testing_setup.get()->m_node.mempool; LOCK2(cs_main, pool.cs); bench.run([&]() NO_THREAD_SAFETY_ANALYSIS { @@ -101,7 +102,7 @@ static void ComplexMemPool(benchmark::Bench& bench) static void MempoolCheck(benchmark::Bench& bench) { FastRandomContext det_rand{true}; - auto testing_setup = MakeNoLogFileContext(CBaseChainParams::REGTEST, {"-checkmempool=1"}); + auto testing_setup = MakeNoLogFileContext(ChainType::REGTEST, {"-checkmempool=1"}); CTxMemPool& pool = *testing_setup.get()->m_node.mempool; LOCK2(cs_main, pool.cs); testing_setup->PopulateMempool(det_rand, 400, true); diff --git a/src/bench/net_processing.cpp b/src/bench/net_processing.cpp index f690d4a96c6d..cdb9b671d2be 100644 --- a/src/bench/net_processing.cpp +++ b/src/bench/net_processing.cpp @@ -14,7 +14,7 @@ using namespace std::literals; static void InventoryBatch(benchmark::Bench& bench, uint32_t count) { - const auto setup = MakeNoLogFileContext(CBaseChainParams::REGTEST); + const auto setup = MakeNoLogFileContext(ChainType::REGTEST); auto& chainstate = *static_cast(&setup->m_node.chainman->ActiveChainstate()); chainstate.JumpOutOfIbd(); auto& peerman = *setup->m_node.peerman; diff --git a/src/bench/rpc_blockchain.cpp b/src/bench/rpc_blockchain.cpp index 62882bf6343e..27b5198d5a27 100644 --- a/src/bench/rpc_blockchain.cpp +++ b/src/bench/rpc_blockchain.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,7 @@ namespace { struct TestBlockAndIndex { - const std::unique_ptr testing_setup{MakeNoLogFileContext(CBaseChainParams::MAIN)}; + const std::unique_ptr testing_setup{MakeNoLogFileContext(ChainType::MAIN)}; CBlock block{}; uint256 blockHash{}; CBlockIndex blockindex{}; diff --git a/src/bench/rpc_mempool.cpp b/src/bench/rpc_mempool.cpp index 23951537c708..37fd8e203e1e 100644 --- a/src/bench/rpc_mempool.cpp +++ b/src/bench/rpc_mempool.cpp @@ -3,12 +3,12 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include #include #include #include #include #include +#include #include @@ -21,7 +21,7 @@ static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& poo static void RpcMempool(benchmark::Bench& bench) { - const auto testing_setup = MakeNoLogFileContext(CBaseChainParams::MAIN); + const auto testing_setup = MakeNoLogFileContext(ChainType::MAIN); CTxMemPool& pool = *Assert(testing_setup->m_node.mempool); LOCK2(cs_main, pool.cs); diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index de391c18bf52..e8dc69795298 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -12,12 +12,15 @@ // It is part of the libbitcoinkernel project. #include +#include #include #include #include #include #include +#include +#include #include #include #include @@ -33,15 +36,18 @@ #include #include