From 83da576f4416c64b5d520819208a722b2273739a Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sun, 10 May 2020 15:47:32 +0200 Subject: [PATCH] net: use CMessageHeader::HEADER_SIZE, add missing include static constexpr CMessageHeader::HEADER_SIZE is already used in this file, src/net.cpp, in 2 instances. This commit replaces the remaining 2 integer values with it and adds the explicit include header. Co-authored by: Gleb Naumenko --- src/net.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 97b80b50e2..9950b9aea4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -631,14 +632,14 @@ int CNode::GetSendVersion() const int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes) { // copy data to temporary parsing buffer - unsigned int nRemaining = 24 - nHdrPos; + unsigned int nRemaining = CMessageHeader::HEADER_SIZE - nHdrPos; unsigned int nCopy = std::min(nRemaining, nBytes); memcpy(&hdrbuf[nHdrPos], pch, nCopy); nHdrPos += nCopy; // if header incomplete, exit - if (nHdrPos < 24) + if (nHdrPos < CMessageHeader::HEADER_SIZE) return nCopy; // deserialize to CMessageHeader