aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-09-06 15:55:14 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-09-12 22:51:38 +0200
commit534b314a7401d44f51aabd4565f97be9ee411740 (patch)
tree7109128d57dc16dcc99c1c0a5d4ae2553c5ae55a /src/kernel
parent9be330b654cfbd792620295f3867f592059d6a7a (diff)
downloadbitcoin-534b314a7401d44f51aabd4565f97be9ee411740.tar.xz
kernel: Move MessageStartChars to its own file
The protocol.h file contains many non-consensus related definitions and should thus not be part of the libbitcoinkernel. This commit makes protocol.h no longer a required include for users of the libbitcoinkernel. This commit is part of the libbitcoinkernel project, namely its stage 1 step 3: Decouple most non-consensus headers from libbitcoinkernel. Co-Authored-By: Cory Fields <cory-nospam-@coryfields.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/chainparams.cpp1
-rw-r--r--src/kernel/chainparams.h6
-rw-r--r--src/kernel/messagestartchars.h13
3 files changed, 17 insertions, 3 deletions
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index c41559ad98..6cee379faf 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -10,6 +10,7 @@
#include <consensus/merkle.h>
#include <consensus/params.h>
#include <hash.h>
+#include <kernel/messagestartchars.h>
#include <logging.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
diff --git a/src/kernel/chainparams.h b/src/kernel/chainparams.h
index 2d38af609c..f1df878f60 100644
--- a/src/kernel/chainparams.h
+++ b/src/kernel/chainparams.h
@@ -7,9 +7,9 @@
#define BITCOIN_KERNEL_CHAINPARAMS_H
#include <consensus/params.h>
+#include <kernel/messagestartchars.h>
#include <netaddress.h>
#include <primitives/block.h>
-#include <protocol.h>
#include <uint256.h>
#include <util/chaintype.h>
#include <util/hash_type.h>
@@ -87,7 +87,7 @@ public:
};
const Consensus::Params& GetConsensus() const { return consensus; }
- const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
+ const MessageStartChars& MessageStart() const { return pchMessageStart; }
uint16_t GetDefaultPort() const { return nDefaultPort; }
uint16_t GetDefaultPort(Network net) const
{
@@ -165,7 +165,7 @@ protected:
CChainParams() {}
Consensus::Params consensus;
- CMessageHeader::MessageStartChars pchMessageStart;
+ MessageStartChars pchMessageStart;
uint16_t nDefaultPort;
uint64_t nPruneAfterHeight;
uint64_t m_assumed_blockchain_size;
diff --git a/src/kernel/messagestartchars.h b/src/kernel/messagestartchars.h
new file mode 100644
index 0000000000..829616dc8b
--- /dev/null
+++ b/src/kernel/messagestartchars.h
@@ -0,0 +1,13 @@
+// Copyright (c) 2023 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_KERNEL_MESSAGESTARTCHARS_H
+#define BITCOIN_KERNEL_MESSAGESTARTCHARS_H
+
+#include <array>
+#include <cstdint>
+
+using MessageStartChars = std::array<uint8_t, 4>;
+
+#endif // BITCOIN_KERNEL_MESSAGESTARTCHARS_H