@@ -1042,7 +1042,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
1042
1042
}
1043
1043
send = BlockRequestAllowed (mi->second , consensusParams);
1044
1044
if (!send) {
1045
- LogPrintf ( " %s: ignoring request from peer=%i for old block that isn't in the main chain\n " , __func__, pfrom->GetId ());
1045
+ LogPrint (BCLog::NET, " %s: ignoring request from peer=%i for old block that isn't in the main chain\n " , __func__, pfrom->GetId ());
1046
1046
}
1047
1047
}
1048
1048
// disconnect node in case we have reached the outbound limit for serving historical blocks
@@ -1511,7 +1511,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1511
1511
if (nVersion < MIN_PEER_PROTO_VERSION)
1512
1512
{
1513
1513
// disconnect from peers older than this proto version
1514
- LogPrintf ( " peer=%d using obsolete version %i; disconnecting\n " , pfrom->GetId (), nVersion);
1514
+ LogPrint (BCLog::NET, " peer=%d using obsolete version %i; disconnecting\n " , pfrom->GetId (), nVersion);
1515
1515
connman->PushMessage (pfrom, CNetMsgMaker (INIT_PROTO_VERSION).Make (NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
1516
1516
strprintf (" Version must be %d or greater" , MIN_PEER_PROTO_VERSION)));
1517
1517
pfrom->fDisconnect = true ;
@@ -1611,7 +1611,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1611
1611
if (fLogIPs )
1612
1612
remoteAddr = " , peeraddr=" + pfrom->addr .ToString ();
1613
1613
1614
- LogPrintf ( " receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n " ,
1614
+ LogPrint (BCLog::NET, " receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n " ,
1615
1615
cleanSubVer, pfrom->nVersion ,
1616
1616
pfrom->nStartingHeight , addrMe.ToString (), pfrom->GetId (),
1617
1617
remoteAddr);
@@ -1654,6 +1654,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1654
1654
// Mark this node as currently connected, so we update its timestamp later.
1655
1655
LOCK (cs_main);
1656
1656
State (pfrom->GetId ())->fCurrentlyConnected = true ;
1657
+ LogPrintf (" New outbound peer connected: version: %d, blocks=%d, peer=%d%s\n " ,
1658
+ pfrom->nVersion .load (), pfrom->nStartingHeight , pfrom->GetId (),
1659
+ (fLogIPs ? strprintf (" , peeraddr=%s" , pfrom->addr .ToString ()) : " " ));
1657
1660
}
1658
1661
1659
1662
if (pfrom->nVersion >= SENDHEADERS_VERSION) {
@@ -1932,7 +1935,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1932
1935
1933
1936
BlockMap::iterator it = mapBlockIndex.find (req.blockhash );
1934
1937
if (it == mapBlockIndex.end () || !(it->second ->nStatus & BLOCK_HAVE_DATA)) {
1935
- LogPrintf ( " Peer %d sent us a getblocktxn for a block we don't have" , pfrom->GetId ());
1938
+ LogPrint (BCLog::NET, " Peer %d sent us a getblocktxn for a block we don't have" , pfrom->GetId ());
1936
1939
return true ;
1937
1940
}
1938
1941
@@ -1984,7 +1987,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1984
1987
pindex = (*mi).second ;
1985
1988
1986
1989
if (!BlockRequestAllowed (pindex, chainparams.GetConsensus ())) {
1987
- LogPrintf ( " %s: ignoring request from peer=%i for old block header that isn't in the main chain\n " , __func__, pfrom->GetId ());
1990
+ LogPrint (BCLog::NET, " %s: ignoring request from peer=%i for old block header that isn't in the main chain\n " , __func__, pfrom->GetId ());
1988
1991
return true ;
1989
1992
}
1990
1993
}
@@ -2232,10 +2235,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2232
2235
int nDoS;
2233
2236
if (state.IsInvalid (nDoS)) {
2234
2237
if (nDoS > 0 ) {
2238
+ LogPrintf (" Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2235
2239
LOCK (cs_main);
2236
2240
Misbehaving (pfrom->GetId (), nDoS);
2241
+ } else {
2242
+ LogPrint (BCLog::NET, " Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2237
2243
}
2238
- LogPrintf (" Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2239
2244
return true ;
2240
2245
}
2241
2246
}
@@ -2837,7 +2842,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2837
2842
msg.SetVersion (pfrom->GetRecvVersion ());
2838
2843
// Scan for message start
2839
2844
if (memcmp (msg.hdr .pchMessageStart , chainparams.MessageStart (), CMessageHeader::MESSAGE_START_SIZE) != 0 ) {
2840
- LogPrintf ( " PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n " , SanitizeString (msg.hdr .GetCommand ()), pfrom->GetId ());
2845
+ LogPrint (BCLog::NET, " PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n " , SanitizeString (msg.hdr .GetCommand ()), pfrom->GetId ());
2841
2846
pfrom->fDisconnect = true ;
2842
2847
return false ;
2843
2848
}
@@ -2846,7 +2851,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2846
2851
CMessageHeader& hdr = msg.hdr ;
2847
2852
if (!hdr.IsValid (chainparams.MessageStart ()))
2848
2853
{
2849
- LogPrintf ( " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (hdr.GetCommand ()), pfrom->GetId ());
2854
+ LogPrint (BCLog::NET, " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (hdr.GetCommand ()), pfrom->GetId ());
2850
2855
return fMoreWork ;
2851
2856
}
2852
2857
std::string strCommand = hdr.GetCommand ();
@@ -2859,7 +2864,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2859
2864
const uint256& hash = msg.GetMessageHash ();
2860
2865
if (memcmp (hash.begin (), hdr.pchChecksum , CMessageHeader::CHECKSUM_SIZE) != 0 )
2861
2866
{
2862
- LogPrintf ( " %s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n " , __func__,
2867
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n " , __func__,
2863
2868
SanitizeString (strCommand), nMessageSize,
2864
2869
HexStr (hash.begin (), hash.begin ()+CMessageHeader::CHECKSUM_SIZE),
2865
2870
HexStr (hdr.pchChecksum , hdr.pchChecksum +CMessageHeader::CHECKSUM_SIZE));
@@ -2882,17 +2887,17 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2882
2887
if (strstr (e.what (), " end of data" ))
2883
2888
{
2884
2889
// Allow exceptions from under-length message on vRecv
2885
- LogPrintf ( " %s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2890
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2886
2891
}
2887
2892
else if (strstr (e.what (), " size too large" ))
2888
2893
{
2889
2894
// Allow exceptions from over-long size
2890
- LogPrintf ( " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2895
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2891
2896
}
2892
2897
else if (strstr (e.what (), " non-canonical ReadCompactSize()" ))
2893
2898
{
2894
2899
// Allow exceptions from non-canonical encoding
2895
- LogPrintf ( " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2900
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2896
2901
}
2897
2902
else
2898
2903
{
@@ -2906,7 +2911,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2906
2911
}
2907
2912
2908
2913
if (!fRet ) {
2909
- LogPrintf ( " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (strCommand), nMessageSize, pfrom->GetId ());
2914
+ LogPrint (BCLog::NET, " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (strCommand), nMessageSize, pfrom->GetId ());
2910
2915
}
2911
2916
2912
2917
LOCK (cs_main);
0 commit comments