@@ -408,7 +408,7 @@ static void UpdatePreferredDownload(CNode* node, CNodeState* state) EXCLUSIVE_LO
408408 nPreferredDownload -= state->fPreferredDownload ;
409409
410410 // Whether this node should be marked as a preferred download node.
411- state->fPreferredDownload = (!node->fInbound || node->fWhitelisted ) && !node->fOneShot && !node->fClient ;
411+ state->fPreferredDownload = (!node->fInbound || node->HasPermission (PF_NOBAN) ) && !node->fOneShot && !node->fClient ;
412412
413413 nPreferredDownload += state->fPreferredDownload ;
414414}
@@ -1398,7 +1398,7 @@ void static ProcessGetBlockData(CNode* pfrom, const CChainParams& chainparams, c
13981398 const CNetMsgMaker msgMaker (pfrom->GetSendVersion ());
13991399 // disconnect node in case we have reached the outbound limit for serving historical blocks
14001400 // never disconnect whitelisted nodes
1401- if (send && connman->OutboundTargetReached (true ) && ( ((pindexBestHeader != nullptr ) && (pindexBestHeader->GetBlockTime () - pindex->GetBlockTime () > HISTORICAL_BLOCK_AGE)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->fWhitelisted )
1401+ if (send && connman->OutboundTargetReached (true ) && ( ((pindexBestHeader != nullptr ) && (pindexBestHeader->GetBlockTime () - pindex->GetBlockTime () > HISTORICAL_BLOCK_AGE)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->HasPermission (PF_NOBAN) )
14021402 {
14031403 LogPrint (BCLog::NET, " historical block serving limit reached, disconnect peer=%d\n " , pfrom->GetId ());
14041404
@@ -1407,7 +1407,7 @@ void static ProcessGetBlockData(CNode* pfrom, const CChainParams& chainparams, c
14071407 send = false ;
14081408 }
14091409 // Avoid leaking prune-height by never sending blocks below the NODE_NETWORK_LIMITED threshold
1410- if (send && !pfrom->fWhitelisted && (
1410+ if (send && !pfrom->HasPermission (PF_NOBAN) && (
14111411 (((pfrom->GetLocalServices () & NODE_NETWORK_LIMITED) == NODE_NETWORK_LIMITED) && ((pfrom->GetLocalServices () & NODE_NETWORK) != NODE_NETWORK) && (::ChainActive ().Tip ()->nHeight - pindex->nHeight > (int )NODE_NETWORK_LIMITED_MIN_BLOCKS + 2 /* add two blocks buffer extension for possible races */ ) )
14121412 )) {
14131413 LogPrint (BCLog::NET, " Ignore block request below NODE_NETWORK_LIMITED threshold from peer=%d\n " , pfrom->GetId ());
@@ -2217,7 +2217,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
22172217 bool fBlocksOnly = !g_relay_txes;
22182218
22192219 // Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistrelay is true
2220- if (pfrom->fWhitelisted && gArgs . GetBoolArg ( " -whitelistrelay " , DEFAULT_WHITELISTRELAY ))
2220+ if (pfrom->HasPermission (PF_RELAY ))
22212221 fBlocksOnly = false ;
22222222
22232223 LOCK (cs_main);
@@ -2412,7 +2412,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
24122412 }
24132413
24142414 LOCK (cs_main);
2415- if (::ChainstateActive ().IsInitialBlockDownload () && !pfrom->fWhitelisted ) {
2415+ if (::ChainstateActive ().IsInitialBlockDownload () && !pfrom->HasPermission (PF_NOBAN) ) {
24162416 LogPrint (BCLog::NET, " Ignoring getheaders from peer=%d because node is in initial block download\n " , pfrom->GetId ());
24172417 return true ;
24182418 }
@@ -2470,7 +2470,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
24702470 if (strCommand == NetMsgType::TX) {
24712471 // Stop processing the transaction early if
24722472 // We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
2473- if (!g_relay_txes && ( !pfrom->fWhitelisted || ! gArgs . GetBoolArg ( " -whitelistrelay " , DEFAULT_WHITELISTRELAY) ))
2473+ if (!g_relay_txes && !pfrom->HasPermission (PF_RELAY ))
24742474 {
24752475 LogPrint (BCLog::NET, " transaction sent in violation of protocol peer=%d\n " , pfrom->GetId ());
24762476 return true ;
@@ -2565,7 +2565,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
25652565 AddToCompactExtraTransactions (ptx);
25662566 }
25672567
2568- if (pfrom->fWhitelisted && gArgs . GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY )) {
2568+ if (pfrom->HasPermission (PF_FORCERELAY )) {
25692569 // Always relay transactions received from whitelisted peers, even
25702570 // if they were already in the mempool or rejected from it due
25712571 // to policy, allowing the node to function as a gateway for
@@ -3010,7 +3010,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
30103010 }
30113011
30123012 if (strCommand == NetMsgType::MEMPOOL) {
3013- if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->fWhitelisted )
3013+ if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->HasPermission (PF_MEMPOOL) )
30143014 {
30153015 if (!pfrom->HasPermission (PF_NOBAN))
30163016 {
@@ -3020,7 +3020,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
30203020 return true ;
30213021 }
30223022
3023- if (connman->OutboundTargetReached (false ) && !pfrom->fWhitelisted )
3023+ if (connman->OutboundTargetReached (false ) && !pfrom->HasPermission (PF_MEMPOOL) )
30243024 {
30253025 if (!pfrom->HasPermission (PF_NOBAN))
30263026 {
@@ -3222,7 +3222,7 @@ bool PeerLogicValidation::SendRejectsAndCheckIfBanned(CNode* pnode, bool enable_
32223222
32233223 if (state.fShouldBan ) {
32243224 state.fShouldBan = false ;
3225- if (pnode->fWhitelisted )
3225+ if (pnode->HasPermission (PF_NOBAN) )
32263226 LogPrintf (" Warning: not punishing whitelisted peer %s!\n " , pnode->addr .ToString ());
32273227 else if (pnode->m_manual_connection )
32283228 LogPrintf (" Warning: not punishing manually-connected peer %s!\n " , pnode->addr .ToString ());
@@ -3792,7 +3792,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
37923792 pto->vInventoryBlockToSend .clear ();
37933793
37943794 // Check whether periodic sends should happen
3795- bool fSendTrickle = pto->fWhitelisted ;
3795+ bool fSendTrickle = pto->HasPermission (PF_NOBAN) ;
37963796 if (pto->nNextInvSend < nNow) {
37973797 fSendTrickle = true ;
37983798 if (pto->fInbound ) {
@@ -3948,7 +3948,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
39483948 // Note: If all our peers are inbound, then we won't
39493949 // disconnect our sync peer for stalling; we have bigger
39503950 // problems if we can't get any outbound peers.
3951- if (!pto->fWhitelisted ) {
3951+ if (!pto->HasPermission (PF_NOBAN) ) {
39523952 LogPrintf (" Timeout downloading headers from peer=%d, disconnecting\n " , pto->GetId ());
39533953 pto->fDisconnect = true ;
39543954 return true ;
@@ -4066,7 +4066,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
40664066 //
40674067 // We don't want white listed peers to filter txs to us if we have -whitelistforcerelay
40684068 if (pto->nVersion >= FEEFILTER_VERSION && gArgs .GetBoolArg (" -feefilter" , DEFAULT_FEEFILTER) &&
4069- !( pto->fWhitelisted && gArgs . GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY) )) {
4069+ !pto->HasPermission (PF_FORCERELAY )) {
40704070 CAmount currentFilter = mempool.GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ).GetFeePerK ();
40714071 int64_t timeNow = GetTimeMicros ();
40724072 if (timeNow > pto->nextSendTimeFeeFilter ) {
0 commit comments