diff options
| author | Pieter Wuille <[email protected]> | 2016-11-07 14:12:26 -0800 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-11-07 14:19:44 -0800 |
| commit | 9f554e03ebe5701c1b75ff03b3d6152095c0cad3 (patch) | |
| tree | 1b71c507fc134b726c5bf39ec48e31396c936568 /src/net.cpp | |
| parent | Merge #9077: [qa] Increase wallet-dump RPC timeout (diff) | |
| parent | Hash P2P messages as they are received instead of at process-time (diff) | |
| download | discoin-9f554e03ebe5701c1b75ff03b3d6152095c0cad3.tar.xz discoin-9f554e03ebe5701c1b75ff03b3d6152095c0cad3.zip | |
Merge #9045: Hash P2P messages as they are received instead of at process-time
fe1dc62 Hash P2P messages as they are received instead of at process-time (Matt Corallo)
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp index 4ab8ef98a..e47a8bb16 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -742,12 +742,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; +} + |