@@ -473,7 +473,7 @@ static void UpdatePreferredDownload(const CNode& node, CNodeState* state) EXCLUS
473
473
nPreferredDownload -= state->fPreferredDownload ;
474
474
475
475
// Whether this node should be marked as a preferred download node.
476
- state->fPreferredDownload = (!node.fInbound || node.HasPermission (PF_NOBAN)) && !node.IsAddrFetchConn () && !node.fClient ;
476
+ state->fPreferredDownload = (!node.IsInboundConn () || node.HasPermission (PF_NOBAN)) && !node.IsAddrFetchConn () && !node.fClient ;
477
477
478
478
nPreferredDownload += state->fPreferredDownload ;
479
479
}
@@ -829,7 +829,7 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
829
829
830
830
static bool IsOutboundDisconnectionCandidate (const CNode& node)
831
831
{
832
- return !(node.fInbound || node.IsManualConn () || node.IsFeelerConn () || node.IsAddrFetchConn ());
832
+ return !(node.IsInboundConn () || node.IsManualConn () || node.IsFeelerConn () || node.IsAddrFetchConn ());
833
833
}
834
834
835
835
void PeerLogicValidation::InitializeNode (CNode *pnode) {
@@ -838,9 +838,9 @@ void PeerLogicValidation::InitializeNode(CNode *pnode) {
838
838
NodeId nodeid = pnode->GetId ();
839
839
{
840
840
LOCK (cs_main);
841
- mapNodeState.emplace_hint (mapNodeState.end (), std::piecewise_construct, std::forward_as_tuple (nodeid), std::forward_as_tuple (addr, std::move (addrName), pnode->fInbound , pnode->IsManualConn ()));
841
+ mapNodeState.emplace_hint (mapNodeState.end (), std::piecewise_construct, std::forward_as_tuple (nodeid), std::forward_as_tuple (addr, std::move (addrName), pnode->IsInboundConn () , pnode->IsManualConn ()));
842
842
}
843
- if (!pnode->fInbound )
843
+ if (!pnode->IsInboundConn () )
844
844
PushNodeVersion (*pnode, *connman, GetTime ());
845
845
}
846
846
@@ -2320,11 +2320,11 @@ void ProcessMessage(
2320
2320
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
2321
2321
nSendVersion = std::min (nVersion, PROTOCOL_VERSION);
2322
2322
nServices = ServiceFlags (nServiceInt);
2323
- if (!pfrom.fInbound )
2323
+ if (!pfrom.IsInboundConn () )
2324
2324
{
2325
2325
connman.SetServices (pfrom.addr , nServices);
2326
2326
}
2327
- if (!pfrom.fInbound && !pfrom.IsFeelerConn () && !pfrom.IsManualConn () && !HasAllDesirableServiceFlags (nServices))
2327
+ if (!pfrom.IsInboundConn () && !pfrom.IsFeelerConn () && !pfrom.IsManualConn () && !HasAllDesirableServiceFlags (nServices))
2328
2328
{
2329
2329
LogPrint (BCLog::NET, " peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n " , pfrom.GetId (), nServices, GetDesirableServiceFlags (nServices));
2330
2330
pfrom.fDisconnect = true ;
@@ -2351,20 +2351,20 @@ void ProcessMessage(
2351
2351
if (!vRecv.empty ())
2352
2352
vRecv >> fRelay ;
2353
2353
// Disconnect if we connected to ourself
2354
- if (pfrom.fInbound && !connman.CheckIncomingNonce (nNonce))
2354
+ if (pfrom.IsInboundConn () && !connman.CheckIncomingNonce (nNonce))
2355
2355
{
2356
2356
LogPrintf (" connected to self at %s, disconnecting\n " , pfrom.addr .ToString ());
2357
2357
pfrom.fDisconnect = true ;
2358
2358
return ;
2359
2359
}
2360
2360
2361
- if (pfrom.fInbound && addrMe.IsRoutable ())
2361
+ if (pfrom.IsInboundConn () && addrMe.IsRoutable ())
2362
2362
{
2363
2363
SeenLocal (addrMe);
2364
2364
}
2365
2365
2366
2366
// Be shy and don't send version until we hear
2367
- if (pfrom.fInbound )
2367
+ if (pfrom.IsInboundConn () )
2368
2368
PushNodeVersion (pfrom, connman, GetAdjustedTime ());
2369
2369
2370
2370
if (nVersion >= WTXID_RELAY_VERSION) {
@@ -2408,7 +2408,7 @@ void ProcessMessage(
2408
2408
UpdatePreferredDownload (pfrom, State (pfrom.GetId ()));
2409
2409
}
2410
2410
2411
- if (!pfrom.fInbound && pfrom.IsAddrRelayPeer ())
2411
+ if (!pfrom.IsInboundConn () && pfrom.IsAddrRelayPeer ())
2412
2412
{
2413
2413
// Advertise our address
2414
2414
if (fListen && !::ChainstateActive ().IsInitialBlockDownload ())
@@ -2472,7 +2472,7 @@ void ProcessMessage(
2472
2472
{
2473
2473
pfrom.SetRecvVersion (std::min (pfrom.nVersion .load (), PROTOCOL_VERSION));
2474
2474
2475
- if (!pfrom.fInbound ) {
2475
+ if (!pfrom.IsInboundConn () ) {
2476
2476
// Mark this node as currently connected, so we update its timestamp later.
2477
2477
LOCK (cs_main);
2478
2478
State (pfrom.GetId ())->fCurrentlyConnected = true ;
@@ -3452,7 +3452,7 @@ void ProcessMessage(
3452
3452
// to users' AddrMan and later request them by sending getaddr messages.
3453
3453
// Making nodes which are behind NAT and can only make outgoing connections ignore
3454
3454
// the getaddr message mitigates the attack.
3455
- if (!pfrom.fInbound ) {
3455
+ if (!pfrom.IsInboundConn () ) {
3456
3456
LogPrint (BCLog::NET, " Ignoring \" getaddr\" from outbound connection. peer=%d\n " , pfrom.GetId ());
3457
3457
return ;
3458
3458
}
@@ -4279,7 +4279,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
4279
4279
bool fSendTrickle = pto->HasPermission (PF_NOBAN);
4280
4280
if (pto->m_tx_relay ->nNextInvSend < current_time) {
4281
4281
fSendTrickle = true ;
4282
- if (pto->fInbound ) {
4282
+ if (pto->IsInboundConn () ) {
4283
4283
pto->m_tx_relay ->nNextInvSend = std::chrono::microseconds{connman->PoissonNextSendInbound (nNow, INVENTORY_BROADCAST_INTERVAL)};
4284
4284
} else {
4285
4285
// Use half the delay for outbound peers, as there is less privacy concern for them.
0 commit comments