Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 774 Lines • ▼ Show 20 Lines | V1TransportDeserializer::GetMessage(const Config &config, | ||||
Reset(); | Reset(); | ||||
return msg; | return msg; | ||||
} | } | ||||
void V1TransportSerializer::prepareForTransport(const Config &config, | void V1TransportSerializer::prepareForTransport(const Config &config, | ||||
CSerializedNetMsg &msg, | CSerializedNetMsg &msg, | ||||
std::vector<uint8_t> &header) { | std::vector<uint8_t> &header) { | ||||
// create dbl-sha256 checksum | // create dbl-sha256 checksum | ||||
uint256 hash = Hash(msg.data.begin(), msg.data.end()); | uint256 hash = Hash(msg.data); | ||||
// create header | // create header | ||||
CMessageHeader hdr(config.GetChainParams().NetMagic(), msg.m_type.c_str(), | CMessageHeader hdr(config.GetChainParams().NetMagic(), msg.m_type.c_str(), | ||||
msg.data.size()); | msg.data.size()); | ||||
memcpy(hdr.pchChecksum, hash.begin(), CMessageHeader::CHECKSUM_SIZE); | memcpy(hdr.pchChecksum, hash.begin(), CMessageHeader::CHECKSUM_SIZE); | ||||
// serialize header | // serialize header | ||||
header.reserve(CMessageHeader::HEADER_SIZE); | header.reserve(CMessageHeader::HEADER_SIZE); | ||||
▲ Show 20 Lines • Show All 2,395 Lines • Show Last 20 Lines |