mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 18:49:30 +01:00
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 <naumenko.gs@gmail.com>
This commit is contained in:
parent
88d8b4e182
commit
83da576f44
@ -16,6 +16,7 @@
|
||||
#include <crypto/sha256.h>
|
||||
#include <netbase.h>
|
||||
#include <net_permissions.h>
|
||||
#include <protocol.h>
|
||||
#include <random.h>
|
||||
#include <scheduler.h>
|
||||
#include <ui_interface.h>
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user