mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-07 18:31:09 +02: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 <crypto/sha256.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <net_permissions.h>
|
#include <net_permissions.h>
|
||||||
|
#include <protocol.h>
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
#include <ui_interface.h>
|
#include <ui_interface.h>
|
||||||
@ -631,14 +632,14 @@ int CNode::GetSendVersion() const
|
|||||||
int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
|
int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
|
||||||
{
|
{
|
||||||
// copy data to temporary parsing buffer
|
// 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);
|
unsigned int nCopy = std::min(nRemaining, nBytes);
|
||||||
|
|
||||||
memcpy(&hdrbuf[nHdrPos], pch, nCopy);
|
memcpy(&hdrbuf[nHdrPos], pch, nCopy);
|
||||||
nHdrPos += nCopy;
|
nHdrPos += nCopy;
|
||||||
|
|
||||||
// if header incomplete, exit
|
// if header incomplete, exit
|
||||||
if (nHdrPos < 24)
|
if (nHdrPos < CMessageHeader::HEADER_SIZE)
|
||||||
return nCopy;
|
return nCopy;
|
||||||
|
|
||||||
// deserialize to CMessageHeader
|
// deserialize to CMessageHeader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user