diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-07-01 01:23:02 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-07-07 20:01:01 +0100 |
commit | 630c1711b47ce50805f4dd2883777a100f7e5339 (patch) | |
tree | 5ef24c1e0014e579d31b5c86cb9436c880f7764d | |
parent | 88ec5d40dcf5d9f95217b123b48203b2f334c0a1 (diff) |
refactor: Drop no longer needed `util/designator.h`
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/init.cpp | 5 | ||||
-rw-r--r-- | src/net.cpp | 29 | ||||
-rw-r--r-- | src/test/util/setup_common.cpp | 5 | ||||
-rw-r--r-- | src/util/designator.h | 21 |
5 files changed, 18 insertions, 43 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3fbbe180fc..b9d2d17121 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -261,7 +261,6 @@ BITCOIN_CORE_H = \ util/bip32.h \ util/bytevectorhash.h \ util/check.h \ - util/designator.h \ util/epochguard.h \ util/error.h \ util/fastrange.h \ diff --git a/src/init.cpp b/src/init.cpp index d844e9b169..061894feff 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -64,7 +64,6 @@ #include <txorphanage.h> #include <util/asmap.h> #include <util/check.h> -#include <util/designator.h> #include <util/moneystr.h> #include <util/strencodings.h> #include <util/string.h> @@ -1424,8 +1423,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) assert(!node.chainman); CTxMemPool::Options mempool_opts{ - Desig(estimator) node.fee_estimator.get(), - Desig(check_ratio) chainparams.DefaultConsistencyChecks() ? 1 : 0, + .estimator = node.fee_estimator.get(), + .check_ratio = chainparams.DefaultConsistencyChecks() ? 1 : 0, }; ApplyArgsManOptions(args, mempool_opts); mempool_opts.check_ratio = std::clamp<int>(mempool_opts.check_ratio, 0, 1'000'000); diff --git a/src/net.cpp b/src/net.cpp index c37d90519c..90c73d583e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -26,7 +26,6 @@ #include <protocol.h> #include <random.h> #include <scheduler.h> -#include <util/designator.h> #include <util/sock.h> #include <util/strencodings.h> #include <util/syscall_sandbox.h> @@ -876,20 +875,20 @@ bool CConnman::AttemptToEvictConnection() if (node->fDisconnect) continue; NodeEvictionCandidate candidate{ - Desig(id) node->GetId(), - Desig(m_connected) node->m_connected, - Desig(m_min_ping_time) node->m_min_ping_time, - Desig(m_last_block_time) node->m_last_block_time, - Desig(m_last_tx_time) node->m_last_tx_time, - Desig(fRelevantServices) HasAllDesirableServiceFlags(node->nServices), - Desig(m_relay_txs) node->m_relays_txs.load(), - Desig(fBloomFilter) node->m_bloom_filter_loaded.load(), - Desig(nKeyedNetGroup) node->nKeyedNetGroup, - Desig(prefer_evict) node->m_prefer_evict, - Desig(m_is_local) node->addr.IsLocal(), - Desig(m_network) node->ConnectedThroughNetwork(), - Desig(m_noban) node->HasPermission(NetPermissionFlags::NoBan), - Desig(m_conn_type) node->m_conn_type, + .id = node->GetId(), + .m_connected = node->m_connected, + .m_min_ping_time = node->m_min_ping_time, + .m_last_block_time = node->m_last_block_time, + .m_last_tx_time = node->m_last_tx_time, + .fRelevantServices = HasAllDesirableServiceFlags(node->nServices), + .m_relay_txs = node->m_relays_txs.load(), + .fBloomFilter = node->m_bloom_filter_loaded.load(), + .nKeyedNetGroup = node->nKeyedNetGroup, + .prefer_evict = node->m_prefer_evict, + .m_is_local = node->addr.IsLocal(), + .m_network = node->ConnectedThroughNetwork(), + .m_noban = node->HasPermission(NetPermissionFlags::NoBan), + .m_conn_type = node->m_conn_type, }; vEvictionCandidates.push_back(candidate); } diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 0c9e880d67..de53499088 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -36,7 +36,6 @@ #include <timedata.h> #include <txdb.h> #include <txmempool.h> -#include <util/designator.h> #include <util/strencodings.h> #include <util/string.h> #include <util/thread.h> @@ -158,10 +157,10 @@ BasicTestingSetup::~BasicTestingSetup() CTxMemPool::Options MemPoolOptionsForTest(const NodeContext& node) { CTxMemPool::Options mempool_opts{ - Desig(estimator) node.fee_estimator.get(), + .estimator = node.fee_estimator.get(), // Default to always checking mempool regardless of // chainparams.DefaultConsistencyChecks for tests - Desig(check_ratio) 1, + .check_ratio = 1, }; ApplyArgsManOptions(*node.args, mempool_opts); return mempool_opts; diff --git a/src/util/designator.h b/src/util/designator.h deleted file mode 100644 index 3670b11e00..0000000000 --- a/src/util/designator.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2022 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_UTIL_DESIGNATOR_H -#define BITCOIN_UTIL_DESIGNATOR_H - -/** - * Designated initializers can be used to avoid ordering mishaps in aggregate - * initialization. However, they do not prevent uninitialized members. The - * checks can be disabled by defining DISABLE_DESIGNATED_INITIALIZER_ERRORS. - * This should only be needed on MSVC 2019. MSVC 2022 supports them with the - * option "/std:c++20" - */ -#ifndef DISABLE_DESIGNATED_INITIALIZER_ERRORS -#define Desig(field_name) .field_name = -#else -#define Desig(field_name) -#endif - -#endif // BITCOIN_UTIL_DESIGNATOR_H |