aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2021-11-02 10:07:46 -0400
committerPieter Wuille <pieter@wuille.net>2021-11-29 17:59:44 -0500
commit11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3 (patch)
tree04577b15fa2b9dbbf611377c5a0e23bf2a705768 /src/net.cpp
parent568dd2f83900a11a4dbba1250722791a135bf0a9 (diff)
downloadbitcoin-11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3.tar.xz
More Span simplifications
Based on suggestions by MarcoFalke <falke.marco@gmail.com>
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index db496c2185..f8b73cdc6b 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -760,7 +760,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
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,
- HexStr(Span<uint8_t>(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
+ HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)),
HexStr(hdr.pchChecksum),
m_node_id);
reject_message = true;
@@ -1582,8 +1582,9 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
if (nBytes > 0)
{
bool notify = false;
- if (!pnode->ReceiveMsgBytes(Span<const uint8_t>(pchBuf, nBytes), notify))
+ if (!pnode->ReceiveMsgBytes({pchBuf, (size_t)nBytes}, notify)) {
pnode->CloseSocketDisconnect();
+ }
RecordBytesRecv(nBytes);
if (notify) {
size_t nSizeAdded = 0;