diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-09-12 13:01:07 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-09-12 22:49:49 +0200 |
commit | 9be330b654cfbd792620295f3867f592059d6a7a (patch) | |
tree | d1596eed457af928c181b2332c292d1c7a982b85 /src/node | |
parent | 37e2b011136ca1cf00dfb9e575d12f0d035a6a2c (diff) | |
download | bitcoin-9be330b654cfbd792620295f3867f592059d6a7a.tar.xz |
[refactor] Define MessageStartChars as std::array
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/blockstorage.cpp | 2 | ||||
-rw-r--r-- | src/node/blockstorage.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 70f11be586..2e4e077f18 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -932,7 +932,7 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF 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..4b57637427 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.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<CMessageHeader::MessageStartChars> + sizeof(unsigned int); extern std::atomic_bool fReindex; |