mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02: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:
parent
2716647ebf
commit
890b1d7c2b
4 changed files with 45 additions and 44 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue