@@ -408,7 +408,7 @@ static void UpdatePreferredDownload(CNode* node, CNodeState* state) EXCLUSIVE_LO
408
408
nPreferredDownload -= state->fPreferredDownload ;
409
409
410
410
// 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 ;
412
412
413
413
nPreferredDownload += state->fPreferredDownload ;
414
414
}
@@ -1398,7 +1398,7 @@ void static ProcessGetBlockData(CNode* pfrom, const CChainParams& chainparams, c
1398
1398
const CNetMsgMaker msgMaker (pfrom->GetSendVersion ());
1399
1399
// disconnect node in case we have reached the outbound limit for serving historical blocks
1400
1400
// 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) )
1402
1402
{
1403
1403
LogPrint (BCLog::NET, " historical block serving limit reached, disconnect peer=%d\n " , pfrom->GetId ());
1404
1404
@@ -1407,7 +1407,7 @@ void static ProcessGetBlockData(CNode* pfrom, const CChainParams& chainparams, c
1407
1407
send = false ;
1408
1408
}
1409
1409
// 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) && (
1411
1411
(((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 */ ) )
1412
1412
)) {
1413
1413
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
2217
2217
bool fBlocksOnly = !g_relay_txes;
2218
2218
2219
2219
// 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 ))
2221
2221
fBlocksOnly = false ;
2222
2222
2223
2223
LOCK (cs_main);
@@ -2412,7 +2412,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2412
2412
}
2413
2413
2414
2414
LOCK (cs_main);
2415
- if (::ChainstateActive ().IsInitialBlockDownload () && !pfrom->fWhitelisted ) {
2415
+ if (::ChainstateActive ().IsInitialBlockDownload () && !pfrom->HasPermission (PF_NOBAN) ) {
2416
2416
LogPrint (BCLog::NET, " Ignoring getheaders from peer=%d because node is in initial block download\n " , pfrom->GetId ());
2417
2417
return true ;
2418
2418
}
@@ -2470,7 +2470,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2470
2470
if (strCommand == NetMsgType::TX) {
2471
2471
// Stop processing the transaction early if
2472
2472
// 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 ))
2474
2474
{
2475
2475
LogPrint (BCLog::NET, " transaction sent in violation of protocol peer=%d\n " , pfrom->GetId ());
2476
2476
return true ;
@@ -2565,7 +2565,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
2565
2565
AddToCompactExtraTransactions (ptx);
2566
2566
}
2567
2567
2568
- if (pfrom->fWhitelisted && gArgs . GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY )) {
2568
+ if (pfrom->HasPermission (PF_FORCERELAY )) {
2569
2569
// Always relay transactions received from whitelisted peers, even
2570
2570
// if they were already in the mempool or rejected from it due
2571
2571
// 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
3010
3010
}
3011
3011
3012
3012
if (strCommand == NetMsgType::MEMPOOL) {
3013
- if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->fWhitelisted )
3013
+ if (!(pfrom->GetLocalServices () & NODE_BLOOM) && !pfrom->HasPermission (PF_MEMPOOL) )
3014
3014
{
3015
3015
if (!pfrom->HasPermission (PF_NOBAN))
3016
3016
{
@@ -3020,7 +3020,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
3020
3020
return true ;
3021
3021
}
3022
3022
3023
- if (connman->OutboundTargetReached (false ) && !pfrom->fWhitelisted )
3023
+ if (connman->OutboundTargetReached (false ) && !pfrom->HasPermission (PF_MEMPOOL) )
3024
3024
{
3025
3025
if (!pfrom->HasPermission (PF_NOBAN))
3026
3026
{
@@ -3222,7 +3222,7 @@ bool PeerLogicValidation::SendRejectsAndCheckIfBanned(CNode* pnode, bool enable_
3222
3222
3223
3223
if (state.fShouldBan ) {
3224
3224
state.fShouldBan = false ;
3225
- if (pnode->fWhitelisted )
3225
+ if (pnode->HasPermission (PF_NOBAN) )
3226
3226
LogPrintf (" Warning: not punishing whitelisted peer %s!\n " , pnode->addr .ToString ());
3227
3227
else if (pnode->m_manual_connection )
3228
3228
LogPrintf (" Warning: not punishing manually-connected peer %s!\n " , pnode->addr .ToString ());
@@ -3792,7 +3792,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3792
3792
pto->vInventoryBlockToSend .clear ();
3793
3793
3794
3794
// Check whether periodic sends should happen
3795
- bool fSendTrickle = pto->fWhitelisted ;
3795
+ bool fSendTrickle = pto->HasPermission (PF_NOBAN) ;
3796
3796
if (pto->nNextInvSend < nNow) {
3797
3797
fSendTrickle = true ;
3798
3798
if (pto->fInbound ) {
@@ -3948,7 +3948,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3948
3948
// Note: If all our peers are inbound, then we won't
3949
3949
// disconnect our sync peer for stalling; we have bigger
3950
3950
// problems if we can't get any outbound peers.
3951
- if (!pto->fWhitelisted ) {
3951
+ if (!pto->HasPermission (PF_NOBAN) ) {
3952
3952
LogPrintf (" Timeout downloading headers from peer=%d, disconnecting\n " , pto->GetId ());
3953
3953
pto->fDisconnect = true ;
3954
3954
return true ;
@@ -4066,7 +4066,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
4066
4066
//
4067
4067
// We don't want white listed peers to filter txs to us if we have -whitelistforcerelay
4068
4068
if (pto->nVersion >= FEEFILTER_VERSION && gArgs .GetBoolArg (" -feefilter" , DEFAULT_FEEFILTER) &&
4069
- !( pto->fWhitelisted && gArgs . GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY) )) {
4069
+ !pto->HasPermission (PF_FORCERELAY )) {
4070
4070
CAmount currentFilter = mempool.GetMinFee (gArgs .GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ).GetFeePerK ();
4071
4071
int64_t timeNow = GetTimeMicros ();
4072
4072
if (timeNow > pto->nextSendTimeFeeFilter ) {
0 commit comments