mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Hash P2P messages as they are received instead of at process-time
This commit is contained in:
parent
d2143dc937
commit
fe1dc62cef
3 changed files with 15 additions and 1 deletions
|
|
@ -758,12 +758,21 @@ int CNetMessage::readData(const char *pch, unsigned int nBytes)
|
|||
vRecv.resize(std::min(hdr.nMessageSize, nDataPos + nCopy + 256 * 1024));
|
||||
}
|
||||
|
||||
hasher.Write((const unsigned char*)pch, nCopy);
|
||||
memcpy(&vRecv[nDataPos], pch, nCopy);
|
||||
nDataPos += nCopy;
|
||||
|
||||
return nCopy;
|
||||
}
|
||||
|
||||
const uint256& CNetMessage::GetMessageHash() const
|
||||
{
|
||||
assert(complete());
|
||||
if (data_hash.IsNull())
|
||||
hasher.Finalize(data_hash.begin());
|
||||
return data_hash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue