@@ -1911,9 +1911,9 @@ void static ProcessOrphanTx(CConnman* connman, CTxMemPool& mempool, std::set<uin
19111911 }
19121912}
19131913
1914- bool ProcessMessage (CNode* pfrom, const std::string& strCommand , CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CTxMemPool& mempool, CConnman* connman, BanMan* banman, const std::atomic<bool >& interruptMsgProc)
1914+ bool ProcessMessage (CNode* pfrom, const std::string& msg_type , CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CTxMemPool& mempool, CConnman* connman, BanMan* banman, const std::atomic<bool >& interruptMsgProc)
19151915{
1916- LogPrint (BCLog::NET, " received: %s (%u bytes) peer=%d\n " , SanitizeString (strCommand ), vRecv.size (), pfrom->GetId ());
1916+ LogPrint (BCLog::NET, " received: %s (%u bytes) peer=%d\n " , SanitizeString (msg_type ), vRecv.size (), pfrom->GetId ());
19171917 if (gArgs .IsArgSet (" -dropmessagestest" ) && GetRand (gArgs .GetArg (" -dropmessagestest" , 0 )) == 0 )
19181918 {
19191919 LogPrintf (" dropmessagestest DROPPING RECV MESSAGE\n " );
@@ -1922,8 +1922,8 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
19221922
19231923
19241924 if (!(pfrom->GetLocalServices () & NODE_BLOOM) &&
1925- (strCommand == NetMsgType::FILTERLOAD ||
1926- strCommand == NetMsgType::FILTERADD))
1925+ (msg_type == NetMsgType::FILTERLOAD ||
1926+ msg_type == NetMsgType::FILTERADD))
19271927 {
19281928 if (pfrom->nVersion >= NO_BLOOM_VERSION) {
19291929 LOCK (cs_main);
@@ -1935,7 +1935,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
19351935 }
19361936 }
19371937
1938- if (strCommand == NetMsgType::VERSION) {
1938+ if (msg_type == NetMsgType::VERSION) {
19391939 // Each connection can only send one version message
19401940 if (pfrom->nVersion != 0 )
19411941 {
@@ -2107,7 +2107,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
21072107 // At this point, the outgoing message serialization version can't change.
21082108 const CNetMsgMaker msgMaker (pfrom->GetSendVersion ());
21092109
2110- if (strCommand == NetMsgType::VERACK)
2110+ if (msg_type == NetMsgType::VERACK)
21112111 {
21122112 pfrom->SetRecvVersion (std::min (pfrom->nVersion .load (), PROTOCOL_VERSION));
21132113
@@ -2152,7 +2152,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
21522152 return false ;
21532153 }
21542154
2155- if (strCommand == NetMsgType::ADDR) {
2155+ if (msg_type == NetMsgType::ADDR) {
21562156 std::vector<CAddress> vAddr;
21572157 vRecv >> vAddr;
21582158
@@ -2206,13 +2206,13 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
22062206 return true ;
22072207 }
22082208
2209- if (strCommand == NetMsgType::SENDHEADERS) {
2209+ if (msg_type == NetMsgType::SENDHEADERS) {
22102210 LOCK (cs_main);
22112211 State (pfrom->GetId ())->fPreferHeaders = true ;
22122212 return true ;
22132213 }
22142214
2215- if (strCommand == NetMsgType::SENDCMPCT) {
2215+ if (msg_type == NetMsgType::SENDCMPCT) {
22162216 bool fAnnounceUsingCMPCTBLOCK = false ;
22172217 uint64_t nCMPCTBLOCKVersion = 0 ;
22182218 vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
@@ -2235,7 +2235,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
22352235 return true ;
22362236 }
22372237
2238- if (strCommand == NetMsgType::INV) {
2238+ if (msg_type == NetMsgType::INV) {
22392239 std::vector<CInv> vInv;
22402240 vRecv >> vInv;
22412241 if (vInv.size () > MAX_INV_SZ)
@@ -2297,7 +2297,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
22972297 return true ;
22982298 }
22992299
2300- if (strCommand == NetMsgType::GETDATA) {
2300+ if (msg_type == NetMsgType::GETDATA) {
23012301 std::vector<CInv> vInv;
23022302 vRecv >> vInv;
23032303 if (vInv.size () > MAX_INV_SZ)
@@ -2318,7 +2318,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
23182318 return true ;
23192319 }
23202320
2321- if (strCommand == NetMsgType::GETBLOCKS) {
2321+ if (msg_type == NetMsgType::GETBLOCKS) {
23222322 CBlockLocator locator;
23232323 uint256 hashStop;
23242324 vRecv >> locator >> hashStop;
@@ -2386,7 +2386,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
23862386 return true ;
23872387 }
23882388
2389- if (strCommand == NetMsgType::GETBLOCKTXN) {
2389+ if (msg_type == NetMsgType::GETBLOCKTXN) {
23902390 BlockTransactionsRequest req;
23912391 vRecv >> req;
23922392
@@ -2435,7 +2435,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
24352435 return true ;
24362436 }
24372437
2438- if (strCommand == NetMsgType::GETHEADERS) {
2438+ if (msg_type == NetMsgType::GETHEADERS) {
24392439 CBlockLocator locator;
24402440 uint256 hashStop;
24412441 vRecv >> locator >> hashStop;
@@ -2502,7 +2502,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
25022502 return true ;
25032503 }
25042504
2505- if (strCommand == NetMsgType::TX) {
2505+ if (msg_type == NetMsgType::TX) {
25062506 // Stop processing the transaction early if
25072507 // We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
25082508 // or if this peer is supposed to be a block-relay-only peer
@@ -2644,7 +2644,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
26442644 return true ;
26452645 }
26462646
2647- if (strCommand == NetMsgType::CMPCTBLOCK)
2647+ if (msg_type == NetMsgType::CMPCTBLOCK)
26482648 {
26492649 // Ignore cmpctblock received while importing
26502650 if (fImporting || fReindex ) {
@@ -2865,7 +2865,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
28652865 return true ;
28662866 }
28672867
2868- if (strCommand == NetMsgType::BLOCKTXN)
2868+ if (msg_type == NetMsgType::BLOCKTXN)
28692869 {
28702870 // Ignore blocktxn received while importing
28712871 if (fImporting || fReindex ) {
@@ -2947,7 +2947,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
29472947 return true ;
29482948 }
29492949
2950- if (strCommand == NetMsgType::HEADERS)
2950+ if (msg_type == NetMsgType::HEADERS)
29512951 {
29522952 // Ignore headers received while importing
29532953 if (fImporting || fReindex ) {
@@ -2973,7 +2973,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
29732973 return ProcessHeadersMessage (pfrom, connman, mempool, headers, chainparams, /* via_compact_block=*/ false );
29742974 }
29752975
2976- if (strCommand == NetMsgType::BLOCK)
2976+ if (msg_type == NetMsgType::BLOCK)
29772977 {
29782978 // Ignore block received while importing
29792979 if (fImporting || fReindex ) {
@@ -3009,7 +3009,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
30093009 return true ;
30103010 }
30113011
3012- if (strCommand == NetMsgType::GETADDR) {
3012+ if (msg_type == NetMsgType::GETADDR) {
30133013 // This asymmetric behavior for inbound and outbound connections was introduced
30143014 // to prevent a fingerprinting attack: an attacker can send specific fake addresses
30153015 // to users' AddrMan and later request them by sending getaddr messages.
@@ -3043,7 +3043,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
30433043 return true ;
30443044 }
30453045
3046- if (strCommand == NetMsgType::MEMPOOL) {
3046+ if (msg_type == NetMsgType::MEMPOOL) {
30473047 if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->HasPermission (PF_MEMPOOL))
30483048 {
30493049 if (!pfrom->HasPermission (PF_NOBAN))
@@ -3071,7 +3071,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
30713071 return true ;
30723072 }
30733073
3074- if (strCommand == NetMsgType::PING) {
3074+ if (msg_type == NetMsgType::PING) {
30753075 if (pfrom->nVersion > BIP0031_VERSION)
30763076 {
30773077 uint64_t nonce = 0 ;
@@ -3092,7 +3092,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
30923092 return true ;
30933093 }
30943094
3095- if (strCommand == NetMsgType::PONG) {
3095+ if (msg_type == NetMsgType::PONG) {
30963096 int64_t pingUsecEnd = nTimeReceived;
30973097 uint64_t nonce = 0 ;
30983098 size_t nAvail = vRecv.in_avail ();
@@ -3148,7 +3148,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
31483148 return true ;
31493149 }
31503150
3151- if (strCommand == NetMsgType::FILTERLOAD) {
3151+ if (msg_type == NetMsgType::FILTERLOAD) {
31523152 CBloomFilter filter;
31533153 vRecv >> filter;
31543154
@@ -3168,7 +3168,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
31683168 return true ;
31693169 }
31703170
3171- if (strCommand == NetMsgType::FILTERADD) {
3171+ if (msg_type == NetMsgType::FILTERADD) {
31723172 std::vector<unsigned char > vData;
31733173 vRecv >> vData;
31743174
@@ -3192,7 +3192,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
31923192 return true ;
31933193 }
31943194
3195- if (strCommand == NetMsgType::FILTERCLEAR) {
3195+ if (msg_type == NetMsgType::FILTERCLEAR) {
31963196 if (pfrom->m_tx_relay == nullptr ) {
31973197 return true ;
31983198 }
@@ -3204,7 +3204,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
32043204 return true ;
32053205 }
32063206
3207- if (strCommand == NetMsgType::FEEFILTER) {
3207+ if (msg_type == NetMsgType::FEEFILTER) {
32083208 CAmount newFeeFilter = 0 ;
32093209 vRecv >> newFeeFilter;
32103210 if (MoneyRange (newFeeFilter)) {
@@ -3217,7 +3217,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
32173217 return true ;
32183218 }
32193219
3220- if (strCommand == NetMsgType::NOTFOUND) {
3220+ if (msg_type == NetMsgType::NOTFOUND) {
32213221 // Remove the NOTFOUND transactions from the peer
32223222 LOCK (cs_main);
32233223 CNodeState *state = State (pfrom->GetId ());
@@ -3243,7 +3243,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
32433243 }
32443244
32453245 // Ignore unknown commands for extensibility
3246- LogPrint (BCLog::NET, " Unknown command \" %s\" from peer=%d\n " , SanitizeString (strCommand ), pfrom->GetId ());
3246+ LogPrint (BCLog::NET, " Unknown command \" %s\" from peer=%d\n " , SanitizeString (msg_type ), pfrom->GetId ());
32473247 return true ;
32483248}
32493249
@@ -3338,7 +3338,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
33383338 LogPrint (BCLog::NET, " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (msg.m_command ), pfrom->GetId ());
33393339 return fMoreWork ;
33403340 }
3341- const std::string& strCommand = msg.m_command ;
3341+ const std::string& msg_type = msg.m_command ;
33423342
33433343 // Message size
33443344 unsigned int nMessageSize = msg.m_message_size ;
@@ -3348,27 +3348,27 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
33483348 if (!msg.m_valid_checksum )
33493349 {
33503350 LogPrint (BCLog::NET, " %s(%s, %u bytes): CHECKSUM ERROR peer=%d\n " , __func__,
3351- SanitizeString (strCommand ), nMessageSize, pfrom->GetId ());
3351+ SanitizeString (msg_type ), nMessageSize, pfrom->GetId ());
33523352 return fMoreWork ;
33533353 }
33543354
33553355 // Process message
33563356 bool fRet = false ;
33573357 try
33583358 {
3359- fRet = ProcessMessage (pfrom, strCommand , vRecv, msg.m_time , chainparams, m_mempool, connman, m_banman, interruptMsgProc);
3359+ fRet = ProcessMessage (pfrom, msg_type , vRecv, msg.m_time , chainparams, m_mempool, connman, m_banman, interruptMsgProc);
33603360 if (interruptMsgProc)
33613361 return false ;
33623362 if (!pfrom->vRecvGetData .empty ())
33633363 fMoreWork = true ;
33643364 } catch (const std::exception& e) {
3365- LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' (%s) caught\n " , __func__, SanitizeString (strCommand ), nMessageSize, e.what (), typeid (e).name ());
3365+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Exception '%s' (%s) caught\n " , __func__, SanitizeString (msg_type ), nMessageSize, e.what (), typeid (e).name ());
33663366 } catch (...) {
3367- LogPrint (BCLog::NET, " %s(%s, %u bytes): Unknown exception caught\n " , __func__, SanitizeString (strCommand ), nMessageSize);
3367+ LogPrint (BCLog::NET, " %s(%s, %u bytes): Unknown exception caught\n " , __func__, SanitizeString (msg_type ), nMessageSize);
33683368 }
33693369
33703370 if (!fRet ) {
3371- LogPrint (BCLog::NET, " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (strCommand ), nMessageSize, pfrom->GetId ());
3371+ LogPrint (BCLog::NET, " %s(%s, %u bytes) FAILED peer=%d\n " , __func__, SanitizeString (msg_type ), nMessageSize, pfrom->GetId ());
33723372 }
33733373
33743374 LOCK (cs_main);
0 commit comments