Skip to content

Commit c113a65

Browse files
committed
Merge #9052: Use RelevantServices instead of node_network in AttemptToEvict.
d32036a Use RelevantServices instead of node_network in AttemptToEvict. (Gregory Maxwell)
2 parents 078900d + d32036a commit c113a65

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/net.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ struct NodeEvictionCandidate
809809
int64_t nMinPingUsecTime;
810810
int64_t nLastBlockTime;
811811
int64_t nLastTXTime;
812-
bool fNetworkNode;
812+
bool fRelevantServices;
813813
bool fRelayTxes;
814814
bool fBloomFilter;
815815
CAddress addr;
@@ -834,7 +834,7 @@ static bool CompareNodeBlockTime(const NodeEvictionCandidate &a, const NodeEvict
834834
{
835835
// There is a fall-through here because it is common for a node to have many peers which have not yet relayed a block.
836836
if (a.nLastBlockTime != b.nLastBlockTime) return a.nLastBlockTime < b.nLastBlockTime;
837-
if (a.fNetworkNode != b.fNetworkNode) return b.fNetworkNode;
837+
if (a.fRelevantServices != b.fRelevantServices) return b.fRelevantServices;
838838
return a.nTimeConnected > b.nTimeConnected;
839839
}
840840

@@ -869,7 +869,8 @@ bool CConnman::AttemptToEvictConnection()
869869
if (node->fDisconnect)
870870
continue;
871871
NodeEvictionCandidate candidate = {node->id, node->nTimeConnected, node->nMinPingUsecTime,
872-
node->nLastBlockTime, node->nLastTXTime, node->fNetworkNode,
872+
node->nLastBlockTime, node->nLastTXTime,
873+
(node->nServices & nRelevantServices) == nRelevantServices,
873874
node->fRelayTxes, node->pfilter != NULL, node->addr, node->nKeyedNetGroup};
874875
vEvictionCandidates.push_back(candidate);
875876
}

0 commit comments

Comments
 (0)