mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-03 18:29:21 +02:00
Merge bitcoin/bitcoin#24078: net, refactor: Rename CNetMessage::m_command with CNetMessage::m_type
224d87855enet, refactor: Drop tautological local variables (Hennadii Stepanov)3073a9917bscripted-diff: Rename CNetMessage::m_command with CNetMessage::m_type (Hennadii Stepanov) Pull request description: https://github.com/bitcoin/bitcoin/pull/18533#issue-594592488: > a message is not a command, but simply a message of some type Continuation of bitcoin/bitcoin#18533 and bitcoin/bitcoin#18937. ACKs for top commit: theStack: Concept and code-review ACK224d87855eshaavan: Code Review ACK224d87855ew0xlt: crACK224d878Tree-SHA512: 898cafb44708dae1413fcc1533d809d75878891354f1b5edaaec1287f4921c31adc9330f4d42d82544a39689886bc17fee71ea587f9199fd5cc849d376f82176
This commit is contained in:
@@ -657,7 +657,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
|
||||
|
||||
// Store received bytes per message command
|
||||
// to prevent a memory DOS, only allow valid commands
|
||||
auto i = mapRecvBytesPerMsgCmd.find(msg.m_command);
|
||||
auto i = mapRecvBytesPerMsgCmd.find(msg.m_type);
|
||||
if (i == mapRecvBytesPerMsgCmd.end()) {
|
||||
i = mapRecvBytesPerMsgCmd.find(NET_MESSAGE_COMMAND_OTHER);
|
||||
}
|
||||
@@ -747,7 +747,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
||||
CNetMessage msg(std::move(vRecv));
|
||||
|
||||
// store command string, time, and sizes
|
||||
msg.m_command = hdr.GetCommand();
|
||||
msg.m_type = hdr.GetCommand();
|
||||
msg.m_time = time;
|
||||
msg.m_message_size = hdr.nMessageSize;
|
||||
msg.m_raw_message_size = hdr.nMessageSize + CMessageHeader::HEADER_SIZE;
|
||||
@@ -760,7 +760,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
||||
// Check checksum and header command string
|
||||
if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
|
||||
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
|
||||
SanitizeString(msg.m_command), msg.m_message_size,
|
||||
SanitizeString(msg.m_type), msg.m_message_size,
|
||||
HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)),
|
||||
HexStr(hdr.pchChecksum),
|
||||
m_node_id);
|
||||
|
||||
Reference in New Issue
Block a user