diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-11-01 00:08:47 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2016-11-01 00:11:52 +0000 |
commit | d32036a47d9ccdc38628a7a75bb8b711af462e4f (patch) | |
tree | 92390008858cc6b437ae8e38db6fb69c645c7049 /src/net.cpp | |
parent | 3d69ecb4edeb80003a1a41442e320898a30dbd9c (diff) |
Use RelevantServices instead of node_network in AttemptToEvict.
Use of node_network here is really meant to be a proxy of "likely to
send us blocks in the future". RelevantServices is the right criteria
now.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 48ba9588d9..6020da16f9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -825,7 +825,7 @@ struct NodeEvictionCandidate int64_t nMinPingUsecTime; int64_t nLastBlockTime; int64_t nLastTXTime; - bool fNetworkNode; + bool fRelevantServices; bool fRelayTxes; bool fBloomFilter; CAddress addr; @@ -850,7 +850,7 @@ static bool CompareNodeBlockTime(const NodeEvictionCandidate &a, const NodeEvict { // There is a fall-through here because it is common for a node to have many peers which have not yet relayed a block. if (a.nLastBlockTime != b.nLastBlockTime) return a.nLastBlockTime < b.nLastBlockTime; - if (a.fNetworkNode != b.fNetworkNode) return b.fNetworkNode; + if (a.fRelevantServices != b.fRelevantServices) return b.fRelevantServices; return a.nTimeConnected > b.nTimeConnected; } @@ -885,7 +885,8 @@ bool CConnman::AttemptToEvictConnection() if (node->fDisconnect) continue; NodeEvictionCandidate candidate = {node->id, node->nTimeConnected, node->nMinPingUsecTime, - node->nLastBlockTime, node->nLastTXTime, node->fNetworkNode, + node->nLastBlockTime, node->nLastTXTime, + (node->nServices & nRelevantServices) == nRelevantServices, node->fRelayTxes, node->pfilter != NULL, node->addr, node->nKeyedNetGroup}; vEvictionCandidates.push_back(candidate); } |