aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
Diffstat (limited to 'src/node')
-rw-r--r--src/node/blockstorage.cpp6
-rw-r--r--src/node/blockstorage.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index f43c5cbec5..f21c94c0a0 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -11,6 +11,7 @@
#include <flatfile.h>
#include <hash.h>
#include <kernel/chainparams.h>
+#include <kernel/messagestartchars.h>
#include <logging.h>
#include <pow.h>
#include <reverse_iterator.h>
@@ -21,6 +22,7 @@
#include <util/batchpriority.h>
#include <util/fs.h>
#include <util/signalinterrupt.h>
+#include <util/strencodings.h>
#include <util/translation.h>
#include <validation.h>
@@ -927,12 +929,12 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
}
try {
- CMessageHeader::MessageStartChars blk_start;
+ MessageStartChars blk_start;
unsigned int blk_size;
filein >> blk_start >> blk_size;
- if (memcmp(blk_start, GetParams().MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
+ if (blk_start != GetParams().MessageStart()) {
return error("%s: Block magic mismatch for %s: %s versus expected %s", __func__, pos.ToString(),
HexStr(blk_start),
HexStr(GetParams().MessageStart()));
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
index c79fd2c6a1..b251ece31f 100644
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -11,7 +11,7 @@
#include <kernel/blockmanager_opts.h>
#include <kernel/chainparams.h>
#include <kernel/cs_main.h>
-#include <protocol.h>
+#include <kernel/messagestartchars.h>
#include <sync.h>
#include <util/fs.h>
#include <util/hasher.h>
@@ -73,7 +73,7 @@ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
/** Size of header written by WriteBlockToDisk before a serialized CBlock */
-static constexpr size_t BLOCK_SERIALIZATION_HEADER_SIZE = CMessageHeader::MESSAGE_START_SIZE + sizeof(unsigned int);
+static constexpr size_t BLOCK_SERIALIZATION_HEADER_SIZE = std::tuple_size_v<MessageStartChars> + sizeof(unsigned int);
extern std::atomic_bool fReindex;