77
88#include " protocol.h"
99
10- #include " chainparams.h"
1110#include " util.h"
1211#include " utilstrencodings.h"
1312
@@ -120,17 +119,17 @@ const static std::string allNetMessageTypes[] = {
120119};
121120const static std::vector<std::string> allNetMessageTypesVec (allNetMessageTypes, allNetMessageTypes + ARRAYLEN(allNetMessageTypes));
122121
123- CMessageHeader::CMessageHeader ()
122+ CMessageHeader::CMessageHeader (const MessageStartChars& pchMessageStartIn )
124123{
125- memcpy (pchMessageStart, Params (). MessageStart () , MESSAGE_START_SIZE);
124+ memcpy (pchMessageStart, pchMessageStartIn , MESSAGE_START_SIZE);
126125 memset (pchCommand, 0 , sizeof (pchCommand));
127126 nMessageSize = -1 ;
128127 nChecksum = 0 ;
129128}
130129
131- CMessageHeader::CMessageHeader (const char * pszCommand, unsigned int nMessageSizeIn)
130+ CMessageHeader::CMessageHeader (const MessageStartChars& pchMessageStartIn, const char * pszCommand, unsigned int nMessageSizeIn)
132131{
133- memcpy (pchMessageStart, Params (). MessageStart () , MESSAGE_START_SIZE);
132+ memcpy (pchMessageStart, pchMessageStartIn , MESSAGE_START_SIZE);
134133 memset (pchCommand, 0 , sizeof (pchCommand));
135134 strncpy (pchCommand, pszCommand, COMMAND_SIZE);
136135 nMessageSize = nMessageSizeIn;
@@ -142,10 +141,10 @@ std::string CMessageHeader::GetCommand() const
142141 return std::string (pchCommand, pchCommand + strnlen (pchCommand, COMMAND_SIZE));
143142}
144143
145- bool CMessageHeader::IsValid () const
144+ bool CMessageHeader::IsValid (const MessageStartChars& pchMessageStartIn ) const
146145{
147146 // Check start string
148- if (memcmp (pchMessageStart, Params (). MessageStart () , MESSAGE_START_SIZE) != 0 )
147+ if (memcmp (pchMessageStart, pchMessageStartIn , MESSAGE_START_SIZE) != 0 )
149148 return false ;
150149
151150 // Check the command string for errors
0 commit comments