@@ -1911,9 +1911,9 @@ void static ProcessOrphanTx(CConnman* connman, CTxMemPool& mempool, std::set<uin
1911
1911
}
1912
1912
}
1913
1913
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)
1915
1915
{
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 ());
1917
1917
if (gArgs .IsArgSet (" -dropmessagestest" ) && GetRand (gArgs .GetArg (" -dropmessagestest" , 0 )) == 0 )
1918
1918
{
1919
1919
LogPrintf (" dropmessagestest DROPPING RECV MESSAGE\n " );
@@ -1922,8 +1922,8 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
1922
1922
1923
1923
1924
1924
if (!(pfrom->GetLocalServices () & NODE_BLOOM) &&
1925
- (strCommand == NetMsgType::FILTERLOAD ||
1926
- strCommand == NetMsgType::FILTERADD))
1925
+ (msg_type == NetMsgType::FILTERLOAD ||
1926
+ msg_type == NetMsgType::FILTERADD))
1927
1927
{
1928
1928
if (pfrom->nVersion >= NO_BLOOM_VERSION) {
1929
1929
LOCK (cs_main);
@@ -1935,7 +1935,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
1935
1935
}
1936
1936
}
1937
1937
1938
- if (strCommand == NetMsgType::VERSION) {
1938
+ if (msg_type == NetMsgType::VERSION) {
1939
1939
// Each connection can only send one version message
1940
1940
if (pfrom->nVersion != 0 )
1941
1941
{
@@ -2107,7 +2107,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2107
2107
// At this point, the outgoing message serialization version can't change.
2108
2108
const CNetMsgMaker msgMaker (pfrom->GetSendVersion ());
2109
2109
2110
- if (strCommand == NetMsgType::VERACK)
2110
+ if (msg_type == NetMsgType::VERACK)
2111
2111
{
2112
2112
pfrom->SetRecvVersion (std::min (pfrom->nVersion .load (), PROTOCOL_VERSION));
2113
2113
@@ -2152,7 +2152,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2152
2152
return false ;
2153
2153
}
2154
2154
2155
- if (strCommand == NetMsgType::ADDR) {
2155
+ if (msg_type == NetMsgType::ADDR) {
2156
2156
std::vector<CAddress> vAddr;
2157
2157
vRecv >> vAddr;
2158
2158
@@ -2206,13 +2206,13 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2206
2206
return true ;
2207
2207
}
2208
2208
2209
- if (strCommand == NetMsgType::SENDHEADERS) {
2209
+ if (msg_type == NetMsgType::SENDHEADERS) {
2210
2210
LOCK (cs_main);
2211
2211
State (pfrom->GetId ())->fPreferHeaders = true ;
2212
2212
return true ;
2213
2213
}
2214
2214
2215
- if (strCommand == NetMsgType::SENDCMPCT) {
2215
+ if (msg_type == NetMsgType::SENDCMPCT) {
2216
2216
bool fAnnounceUsingCMPCTBLOCK = false ;
2217
2217
uint64_t nCMPCTBLOCKVersion = 0 ;
2218
2218
vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
@@ -2235,7 +2235,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2235
2235
return true ;
2236
2236
}
2237
2237
2238
- if (strCommand == NetMsgType::INV) {
2238
+ if (msg_type == NetMsgType::INV) {
2239
2239
std::vector<CInv> vInv;
2240
2240
vRecv >> vInv;
2241
2241
if (vInv.size () > MAX_INV_SZ)
@@ -2297,7 +2297,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2297
2297
return true ;
2298
2298
}
2299
2299
2300
- if (strCommand == NetMsgType::GETDATA) {
2300
+ if (msg_type == NetMsgType::GETDATA) {
2301
2301
std::vector<CInv> vInv;
2302
2302
vRecv >> vInv;
2303
2303
if (vInv.size () > MAX_INV_SZ)
@@ -2318,7 +2318,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2318
2318
return true ;
2319
2319
}
2320
2320
2321
- if (strCommand == NetMsgType::GETBLOCKS) {
2321
+ if (msg_type == NetMsgType::GETBLOCKS) {
2322
2322
CBlockLocator locator;
2323
2323
uint256 hashStop;
2324
2324
vRecv >> locator >> hashStop;
@@ -2386,7 +2386,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2386
2386
return true ;
2387
2387
}
2388
2388
2389
- if (strCommand == NetMsgType::GETBLOCKTXN) {
2389
+ if (msg_type == NetMsgType::GETBLOCKTXN) {
2390
2390
BlockTransactionsRequest req;
2391
2391
vRecv >> req;
2392
2392
@@ -2435,7 +2435,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2435
2435
return true ;
2436
2436
}
2437
2437
2438
- if (strCommand == NetMsgType::GETHEADERS) {
2438
+ if (msg_type == NetMsgType::GETHEADERS) {
2439
2439
CBlockLocator locator;
2440
2440
uint256 hashStop;
2441
2441
vRecv >> locator >> hashStop;
@@ -2502,7 +2502,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2502
2502
return true ;
2503
2503
}
2504
2504
2505
- if (strCommand == NetMsgType::TX) {
2505
+ if (msg_type == NetMsgType::TX) {
2506
2506
// Stop processing the transaction early if
2507
2507
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
2508
2508
// 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
2644
2644
return true ;
2645
2645
}
2646
2646
2647
- if (strCommand == NetMsgType::CMPCTBLOCK)
2647
+ if (msg_type == NetMsgType::CMPCTBLOCK)
2648
2648
{
2649
2649
// Ignore cmpctblock received while importing
2650
2650
if (fImporting || fReindex ) {
@@ -2865,7 +2865,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2865
2865
return true ;
2866
2866
}
2867
2867
2868
- if (strCommand == NetMsgType::BLOCKTXN)
2868
+ if (msg_type == NetMsgType::BLOCKTXN)
2869
2869
{
2870
2870
// Ignore blocktxn received while importing
2871
2871
if (fImporting || fReindex ) {
@@ -2947,7 +2947,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2947
2947
return true ;
2948
2948
}
2949
2949
2950
- if (strCommand == NetMsgType::HEADERS)
2950
+ if (msg_type == NetMsgType::HEADERS)
2951
2951
{
2952
2952
// Ignore headers received while importing
2953
2953
if (fImporting || fReindex ) {
@@ -2973,7 +2973,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
2973
2973
return ProcessHeadersMessage (pfrom, connman, mempool, headers, chainparams, /* via_compact_block=*/ false );
2974
2974
}
2975
2975
2976
- if (strCommand == NetMsgType::BLOCK)
2976
+ if (msg_type == NetMsgType::BLOCK)
2977
2977
{
2978
2978
// Ignore block received while importing
2979
2979
if (fImporting || fReindex ) {
@@ -3009,7 +3009,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3009
3009
return true ;
3010
3010
}
3011
3011
3012
- if (strCommand == NetMsgType::GETADDR) {
3012
+ if (msg_type == NetMsgType::GETADDR) {
3013
3013
// This asymmetric behavior for inbound and outbound connections was introduced
3014
3014
// to prevent a fingerprinting attack: an attacker can send specific fake addresses
3015
3015
// 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
3043
3043
return true ;
3044
3044
}
3045
3045
3046
- if (strCommand == NetMsgType::MEMPOOL) {
3046
+ if (msg_type == NetMsgType::MEMPOOL) {
3047
3047
if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->HasPermission (PF_MEMPOOL))
3048
3048
{
3049
3049
if (!pfrom->HasPermission (PF_NOBAN))
@@ -3071,7 +3071,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3071
3071
return true ;
3072
3072
}
3073
3073
3074
- if (strCommand == NetMsgType::PING) {
3074
+ if (msg_type == NetMsgType::PING) {
3075
3075
if (pfrom->nVersion > BIP0031_VERSION)
3076
3076
{
3077
3077
uint64_t nonce = 0 ;
@@ -3092,7 +3092,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3092
3092
return true ;
3093
3093
}
3094
3094
3095
- if (strCommand == NetMsgType::PONG) {
3095
+ if (msg_type == NetMsgType::PONG) {
3096
3096
int64_t pingUsecEnd = nTimeReceived;
3097
3097
uint64_t nonce = 0 ;
3098
3098
size_t nAvail = vRecv.in_avail ();
@@ -3148,7 +3148,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3148
3148
return true ;
3149
3149
}
3150
3150
3151
- if (strCommand == NetMsgType::FILTERLOAD) {
3151
+ if (msg_type == NetMsgType::FILTERLOAD) {
3152
3152
CBloomFilter filter;
3153
3153
vRecv >> filter;
3154
3154
@@ -3168,7 +3168,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3168
3168
return true ;
3169
3169
}
3170
3170
3171
- if (strCommand == NetMsgType::FILTERADD) {
3171
+ if (msg_type == NetMsgType::FILTERADD) {
3172
3172
std::vector<unsigned char > vData;
3173
3173
vRecv >> vData;
3174
3174
@@ -3192,7 +3192,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3192
3192
return true ;
3193
3193
}
3194
3194
3195
- if (strCommand == NetMsgType::FILTERCLEAR) {
3195
+ if (msg_type == NetMsgType::FILTERCLEAR) {
3196
3196
if (pfrom->m_tx_relay == nullptr ) {
3197
3197
return true ;
3198
3198
}
@@ -3204,7 +3204,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3204
3204
return true ;
3205
3205
}
3206
3206
3207
- if (strCommand == NetMsgType::FEEFILTER) {
3207
+ if (msg_type == NetMsgType::FEEFILTER) {
3208
3208
CAmount newFeeFilter = 0 ;
3209
3209
vRecv >> newFeeFilter;
3210
3210
if (MoneyRange (newFeeFilter)) {
@@ -3217,7 +3217,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3217
3217
return true ;
3218
3218
}
3219
3219
3220
- if (strCommand == NetMsgType::NOTFOUND) {
3220
+ if (msg_type == NetMsgType::NOTFOUND) {
3221
3221
// Remove the NOTFOUND transactions from the peer
3222
3222
LOCK (cs_main);
3223
3223
CNodeState *state = State (pfrom->GetId ());
@@ -3243,7 +3243,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vR
3243
3243
}
3244
3244
3245
3245
// 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 ());
3247
3247
return true ;
3248
3248
}
3249
3249
@@ -3338,7 +3338,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
3338
3338
LogPrint (BCLog::NET, " PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n " , SanitizeString (msg.m_command ), pfrom->GetId ());
3339
3339
return fMoreWork ;
3340
3340
}
3341
- const std::string& strCommand = msg.m_command ;
3341
+ const std::string& msg_type = msg.m_command ;
3342
3342
3343
3343
// Message size
3344
3344
unsigned int nMessageSize = msg.m_message_size ;
@@ -3348,27 +3348,27 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
3348
3348
if (!msg.m_valid_checksum )
3349
3349
{
3350
3350
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 ());
3352
3352
return fMoreWork ;
3353
3353
}
3354
3354
3355
3355
// Process message
3356
3356
bool fRet = false ;
3357
3357
try
3358
3358
{
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);
3360
3360
if (interruptMsgProc)
3361
3361
return false ;
3362
3362
if (!pfrom->vRecvGetData .empty ())
3363
3363
fMoreWork = true ;
3364
3364
} 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 ());
3366
3366
} 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);
3368
3368
}
3369
3369
3370
3370
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 ());
3372
3372
}
3373
3373
3374
3374
LOCK (cs_main);
0 commit comments