mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Move checksum check from net_processing to net
This removes the m_valid_checksum member from CNetMessage. Instead, GetMessage() returns an Optional. Additionally, GetMessage() has been given an out parameter to be used to hold error information. For now it is specifically a uint32_t used to hold the raw size of the corrupt message. The checksum check is now done in GetMessage.
This commit is contained in:
@@ -3886,17 +3886,8 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
|
||||
// Message size
|
||||
unsigned int nMessageSize = msg.m_message_size;
|
||||
|
||||
// Checksum
|
||||
CDataStream& vRecv = msg.m_recv;
|
||||
if (!msg.m_valid_checksum)
|
||||
{
|
||||
LogPrint(BCLog::NET, "%s(%s, %u bytes): CHECKSUM ERROR peer=%d\n", __func__,
|
||||
SanitizeString(msg_type), nMessageSize, pfrom->GetId());
|
||||
return fMoreWork;
|
||||
}
|
||||
|
||||
try {
|
||||
ProcessMessage(*pfrom, msg_type, vRecv, msg.m_time, interruptMsgProc);
|
||||
ProcessMessage(*pfrom, msg_type, msg.m_recv, msg.m_time, interruptMsgProc);
|
||||
if (interruptMsgProc)
|
||||
return false;
|
||||
if (!pfrom->vRecvGetData.empty())
|
||||
|
||||
Reference in New Issue
Block a user