mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge bitcoin/bitcoin#28423: kernel: Remove protocol.h/netaddress.h/compat.h from kernel headers
d506765199[refactor] Remove compat.h from kernel headers (TheCharlatan)36193af47c[refactor] Remove netaddress.h from kernel headers (TheCharlatan)2b08c55f01[refactor] Add CChainParams member to CConnman (TheCharlatan)f0d1d8b35c[refactor] Add missing includes for next commit (TheCharlatan)534b314a74kernel: Move MessageStartChars to its own file (TheCharlatan)9be330b654[refactor] Define MessageStartChars as std::array (TheCharlatan)37e2b01113[refactor] Allow std::array<std::byte, N> in serialize.h (MarcoFalke) Pull request description: This removes the non-consensus critical `protocol.h` and `netaddress.h` headers from the kernel headers. With this patch, they are no longer required to include in order to use the libbitcoinkernel library. This also allows for the removal of the `compat.h` header from the kernel headers. As an added future benefit it also reduces the number of of kernel headers that include the platform specific `bitcoin-config.h`. For those interested, the currently required kernel headers can be inspected visually with the [sourcetrail](https://github.com/CoatiSoftware/Sourcetrail) tool by looking at the required includes of `bitcoin-chainstate.cpp`. --- This is part of the [libbitcoinkernel project](https://github.com/bitcoin/bitcoin/issues/27587), namely its stage 1 step 3: Decouple most non-consensus headers from libbitcoinkernel. ACKs for top commit: stickies-v: re-ACKd506765hebasto: ACKd506765199. ajtowns: utACKd506765199MarcoFalke: lgtm ACKd506765199🍛 Tree-SHA512: 6f90ea510a302c2927e84d16900e89997c39b8ff3ce9d4effeb8a134bd29cc52bd9e81e51aaa11f7496bad00025b78a58b88c5a9e0bb3f4ebbe9a76309215fb7
This commit is contained in:
@@ -142,7 +142,7 @@ static void AddRandomOutboundPeer(NodeId& id, std::vector<CNode*>& vNodes, PeerM
|
||||
BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
|
||||
{
|
||||
NodeId id{0};
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman);
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params());
|
||||
auto peerLogic = PeerManager::make(*connman, *m_node.addrman, nullptr, *m_node.chainman, *m_node.mempool, {});
|
||||
|
||||
constexpr int max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS;
|
||||
@@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
|
||||
BOOST_AUTO_TEST_CASE(block_relay_only_eviction)
|
||||
{
|
||||
NodeId id{0};
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman);
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params());
|
||||
auto peerLogic = PeerManager::make(*connman, *m_node.addrman, nullptr, *m_node.chainman, *m_node.mempool, {});
|
||||
|
||||
constexpr int max_outbound_block_relay{MAX_BLOCK_RELAY_ONLY_CONNECTIONS};
|
||||
@@ -305,7 +305,7 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
|
||||
LOCK(NetEventsInterface::g_msgproc_mutex);
|
||||
|
||||
auto banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman);
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params());
|
||||
auto peerLogic = PeerManager::make(*connman, *m_node.addrman, banman.get(), *m_node.chainman, *m_node.mempool, {});
|
||||
|
||||
CNetAddr tor_netaddr;
|
||||
@@ -407,7 +407,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
LOCK(NetEventsInterface::g_msgproc_mutex);
|
||||
|
||||
auto banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman);
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params());
|
||||
auto peerLogic = PeerManager::make(*connman, *m_node.addrman, banman.get(), *m_node.chainman, *m_node.mempool, {});
|
||||
|
||||
banman->ClearBanned();
|
||||
|
||||
@@ -36,6 +36,7 @@ FUZZ_TARGET(connman, .init = initialize_connman)
|
||||
fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
*g_setup->m_node.addrman,
|
||||
*g_setup->m_node.netgroupman,
|
||||
Params(),
|
||||
fuzzed_data_provider.ConsumeBool()};
|
||||
CNetAddr random_netaddr;
|
||||
CNode random_node = ConsumeNode(fuzzed_data_provider);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <script/descriptor.h>
|
||||
#include <test/fuzz/fuzz.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
//! Types are raw (un)compressed pubkeys, raw xonly pubkeys, raw privkeys (WIF), xpubs, xprvs.
|
||||
static constexpr uint8_t KEY_TYPES_COUNT{6};
|
||||
|
||||
@@ -1114,7 +1114,7 @@ public:
|
||||
}
|
||||
|
||||
/** Send V1 version message header to the transport. */
|
||||
void SendV1Version(const CMessageHeader::MessageStartChars& magic)
|
||||
void SendV1Version(const MessageStartChars& magic)
|
||||
{
|
||||
CMessageHeader hdr(magic, "version", 126 + InsecureRandRange(11));
|
||||
CDataStream ser(SER_NETWORK, CLIENT_VERSION);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <consensus/validation.h>
|
||||
#include <key.h>
|
||||
#include <random.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <test/util/setup_common.h>
|
||||
|
||||
@@ -253,7 +253,7 @@ TestingSetup::TestingSetup(
|
||||
/*deterministic=*/false,
|
||||
m_node.args->GetIntArg("-checkaddrman", 0));
|
||||
m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
m_node.connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman); // Deterministic randomness for tests.
|
||||
m_node.connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params()); // Deterministic randomness for tests.
|
||||
PeerManager::Options peerman_opts;
|
||||
ApplyArgsManOptions(*m_node.args, peerman_opts);
|
||||
m_node.peerman = PeerManager::make(*m_node.connman, *m_node.addrman,
|
||||
|
||||
Reference in New Issue
Block a user