@@ -1078,7 +1078,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
1078
1078
}
1079
1079
send = BlockRequestAllowed (mi->second , consensusParams);
1080
1080
if (!send) {
1081
- LogPrintf ( " %s: ignoring request from peer=%i for old block that isn't in the main chain\n " , __func__, pfrom->GetId ());
1081
+ LogPrint (BCLog::NET, " %s: ignoring request from peer=%i for old block that isn't in the main chain\n " , __func__, pfrom->GetId ());
1082
1082
}
1083
1083
}
1084
1084
// disconnect node in case we have reached the outbound limit for serving historical blocks
@@ -1569,7 +1569,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1569
1569
if (nVersion < MIN_PEER_PROTO_VERSION)
1570
1570
{
1571
1571
// disconnect from peers older than this proto version
1572
- LogPrintf ( " peer=%d using obsolete version %i; disconnecting\n " , pfrom->GetId (), nVersion);
1572
+ LogPrint (BCLog::NET, " peer=%d using obsolete version %i; disconnecting\n " , pfrom->GetId (), nVersion);
1573
1573
connman->PushMessage (pfrom, CNetMsgMaker (INIT_PROTO_VERSION).Make (NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
1574
1574
strprintf (" Version must be %d or greater" , MIN_PEER_PROTO_VERSION)));
1575
1575
pfrom->fDisconnect = true ;
@@ -1669,7 +1669,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1669
1669
if (fLogIPs )
1670
1670
remoteAddr = " , peeraddr=" + pfrom->addr .ToString ();
1671
1671
1672
- LogPrintf ( " receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n " ,
1672
+ LogPrint (BCLog::NET, " receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n " ,
1673
1673
cleanSubVer, pfrom->nVersion ,
1674
1674
pfrom->nStartingHeight , addrMe.ToString (), pfrom->GetId (),
1675
1675
remoteAddr);
@@ -1712,6 +1712,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1712
1712
// Mark this node as currently connected, so we update its timestamp later.
1713
1713
LOCK (cs_main);
1714
1714
State (pfrom->GetId ())->fCurrentlyConnected = true ;
1715
+ LogPrintf (" New outbound peer connected: version: %d, blocks=%d, peer=%d%s\n " ,
1716
+ pfrom->nVersion .load (), pfrom->nStartingHeight , pfrom->GetId (),
1717
+ (fLogIPs ? strprintf (" , peeraddr=%s" , pfrom->addr .ToString ()) : " " ));
1715
1718
}
1716
1719
1717
1720
if (pfrom->nVersion >= SENDHEADERS_VERSION) {
@@ -1990,7 +1993,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
1990
1993
1991
1994
BlockMap::iterator it = mapBlockIndex.find (req.blockhash );
1992
1995
if (it == mapBlockIndex.end () || !(it->second ->nStatus & BLOCK_HAVE_DATA)) {
1993
- LogPrintf ( " Peer %d sent us a getblocktxn for a block we don't have" , pfrom->GetId ());
1996
+ LogPrint (BCLog::NET, " Peer %d sent us a getblocktxn for a block we don't have" , pfrom->GetId ());
1994
1997
return true ;
1995
1998
}
1996
1999
@@ -2042,7 +2045,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2042
2045
pindex = (*mi).second ;
2043
2046
2044
2047
if (!BlockRequestAllowed (pindex, chainparams.GetConsensus ())) {
2045
- LogPrintf ( " %s: ignoring request from peer=%i for old block header that isn't in the main chain\n " , __func__, pfrom->GetId ());
2048
+ LogPrint (BCLog::NET, " %s: ignoring request from peer=%i for old block header that isn't in the main chain\n " , __func__, pfrom->GetId ());
2046
2049
return true ;
2047
2050
}
2048
2051
}
@@ -2296,10 +2299,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2296
2299
int nDoS;
2297
2300
if (state.IsInvalid (nDoS)) {
2298
2301
if (nDoS > 0 ) {
2302
+ LogPrintf (" Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2299
2303
LOCK (cs_main);
2300
2304
Misbehaving (pfrom->GetId (), nDoS);
2305
+ } else {
2306
+ LogPrint (BCLog::NET, " Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2301
2307
}
2302
- LogPrintf (" Peer %d sent us invalid header via cmpctblock\n " , pfrom->GetId ());
2303
2308
return true ;
2304
2309
}
2305
2310
}
@@ -2901,7 +2906,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2901
2906
msg.SetVersion (pfrom->GetRecvVersion ());
2902
2907
// Scan for message start
2903
2908
if (memcmp (msg.hdr .pchMessageStart , chainparams.MessageStart (), CMessageHeader::MESSAGE_START_SIZE) != 0 ) {
2904
- LogPrintf ( " PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n " , SanitizeString (msg.hdr .GetCommand ()), pfrom->GetId ());
2909
+ LogPrint (BCLog::NET, " PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n " , SanitizeString (msg.hdr .GetCommand ()), pfrom->GetId ());
2905
2910
pfrom->fDisconnect = true ;
2906
2911
return false ;
2907
2912
}
@@ -2910,7 +2915,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2910
2915
CMessageHeader& hdr = msg.hdr ;
2911
2916
if (!hdr.IsValid (chainparams.MessageStart ()))
2912
2917
{
2913
- LogPrintf ( " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (hdr.GetCommand ()), pfrom->GetId ());
2918
+ LogPrint (BCLog::NET, " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (hdr.GetCommand ()), pfrom->GetId ());
2914
2919
return fMoreWork ;
2915
2920
}
2916
2921
std::string strCommand = hdr.GetCommand ();
@@ -2923,7 +2928,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2923
2928
const uint256& hash = msg.GetMessageHash ();
2924
2929
if (memcmp (hash.begin (), hdr.pchChecksum , CMessageHeader::CHECKSUM_SIZE) != 0 )
2925
2930
{
2926
- LogPrintf ( " %s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n " , __func__,
2931
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n " , __func__,
2927
2932
SanitizeString (strCommand), nMessageSize,
2928
2933
HexStr (hash.begin (), hash.begin ()+CMessageHeader::CHECKSUM_SIZE),
2929
2934
HexStr (hdr.pchChecksum , hdr.pchChecksum +CMessageHeader::CHECKSUM_SIZE));
@@ -2946,17 +2951,17 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2946
2951
if (strstr (e.what (), " end of data" ))
2947
2952
{
2948
2953
// Allow exceptions from under-length message on vRecv
2949
- 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 ());
2954
+ 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 ());
2950
2955
}
2951
2956
else if (strstr (e.what (), " size too large" ))
2952
2957
{
2953
2958
// Allow exceptions from over-long size
2954
- LogPrintf ( " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2959
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2955
2960
}
2956
2961
else if (strstr (e.what (), " non-canonical ReadCompactSize()" ))
2957
2962
{
2958
2963
// Allow exceptions from non-canonical encoding
2959
- LogPrintf ( " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2964
+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' caught\n " , __func__, SanitizeString (strCommand), nMessageSize, e.what ());
2960
2965
}
2961
2966
else
2962
2967
{
@@ -2970,7 +2975,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
2970
2975
}
2971
2976
2972
2977
if (!fRet ) {
2973
- LogPrintf ( " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (strCommand), nMessageSize, pfrom->GetId ());
2978
+ LogPrint (BCLog::NET, " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (strCommand), nMessageSize, pfrom->GetId ());
2974
2979
}
2975
2980
2976
2981
LOCK (cs_main);
0 commit comments