Skip to content

Commit c749b13

Browse files
committed
Remove redundant message network magic check
1 parent 365e838 commit c749b13

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/net_processing.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,12 +3015,6 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
30153015
CNetMessage& msg(msgs.front());
30163016

30173017
msg.SetVersion(pfrom->GetRecvVersion());
3018-
// Scan for message start
3019-
if (memcmp(msg.hdr.pchMessageStart, chainparams.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
3020-
LogPrint(BCLog::NET, "PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->GetId());
3021-
pfrom->fDisconnect = true;
3022-
return false;
3023-
}
30243018

30253019
// Read header
30263020
CMessageHeader& hdr = msg.hdr;

src/protocol.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ std::string CMessageHeader::GetCommand() const
101101
bool CMessageHeader::IsValid(const MessageStartChars& pchMessageStartIn) const
102102
{
103103
// Check start string
104-
if (memcmp(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE) != 0)
104+
if (memcmp(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE) != 0) {
105+
LogPrint(BCLog::NET, "INVALID MESSAGESTART %s\n", SanitizeString(GetCommand()));
105106
return false;
107+
}
106108

107109
// Check the command string for errors
108110
for (const char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++)

0 commit comments

Comments
 (0)