@ -10,7 +10,6 @@
# include <net.h>
# include <banman.h>
# include <chainparams.h>
# include <clientversion.h>
# include <consensus/consensus.h>
# include <crypto/sha256.h>
@ -615,7 +614,7 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete
if ( m_deserializer - > Complete ( ) ) {
// decompose a transport agnostic CNetMessage from the deserializer
uint32_t out_err_raw_size { 0 } ;
Optional < CNetMessage > result { m_deserializer - > GetMessage ( Params( ) . MessageStart ( ) , time, out_err_raw_size ) } ;
Optional < CNetMessage > result { m_deserializer - > GetMessage ( time, out_err_raw_size ) } ;
if ( ! result ) {
// store the size of the corrupt message
mapRecvBytesPerMsgCmd . find ( NET_MESSAGE_COMMAND_OTHER ) - > second + = out_err_raw_size ;
@ -697,15 +696,14 @@ const uint256& V1TransportDeserializer::GetMessageHash() const
return data_hash ;
}
Optional < CNetMessage > V1TransportDeserializer : : GetMessage ( const CMessageHeader: : MessageStartChars & message_start , const std: : chrono : : microseconds time , uint32_t & out_err_raw_size )
Optional < CNetMessage > V1TransportDeserializer : : GetMessage ( const std: : chrono : : microseconds time , uint32_t & out_err_raw_size )
{
// decompose a single CNetMessage from the TransportDeserializer
Optional < CNetMessage > msg ( std : : move ( vRecv ) ) ;
// store state about valid header, netmagic and checksum
msg - > m_valid_header = hdr . IsValid ( message_start ) ;
msg - > m_valid_netmagic = ( memcmp ( hdr . pchMessageStart , message_start , CMessageHeader : : MESSAGE_START_SIZE ) = = 0 ) ;
uint256 hash = GetMessageHash ( ) ;
msg - > m_valid_header = hdr . IsValid ( m_chain_params . MessageStart ( ) ) ;
msg - > m_valid_netmagic = ( memcmp ( hdr . pchMessageStart , m_chain_params . MessageStart ( ) , CMessageHeader : : MESSAGE_START_SIZE ) = = 0 ) ;
// store command string, time, and sizes
msg - > m_command = hdr . GetCommand ( ) ;
@ -713,6 +711,8 @@ Optional<CNetMessage> V1TransportDeserializer::GetMessage(const CMessageHeader::
msg - > m_message_size = hdr . nMessageSize ;
msg - > m_raw_message_size = hdr . nMessageSize + CMessageHeader : : HEADER_SIZE ;
uint256 hash = GetMessageHash ( ) ;
// We just received a message off the wire, harvest entropy from the time (and the message checksum)
RandAddEvent ( ReadLE32 ( hash . begin ( ) ) ) ;
@ -2846,7 +2846,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
LogPrint ( BCLog : : NET , " Added connection peer=%d \n " , id ) ;
}
m_deserializer = MakeUnique < V1TransportDeserializer > ( V1TransportDeserializer ( GetId( ) , SER_NETWORK , INIT_PROTO_VERSION ) ) ;
m_deserializer = MakeUnique < V1TransportDeserializer > ( V1TransportDeserializer ( Params( ) , GetId( ) , SER_NETWORK , INIT_PROTO_VERSION ) ) ;
m_serializer = MakeUnique < V1TransportSerializer > ( V1TransportSerializer ( ) ) ;
}