mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
net: mark TransportSerializer/m_serializer as const
The (V1)TransportSerializer instance CNode::m_serializer is used from multiple threads via PushMessage without protection by a mutex. This is only thread safe because the class does not have any mutable state, so document that by marking the methods and the object as "const".
This commit is contained in:
@@ -797,7 +797,8 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
||||
return msg;
|
||||
}
|
||||
|
||||
void V1TransportSerializer::prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) {
|
||||
void V1TransportSerializer::prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) const
|
||||
{
|
||||
// create dbl-sha256 checksum
|
||||
uint256 hash = Hash(msg.data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user