diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-11-01 00:08:47 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2016-12-02 07:41:11 +0000 |
commit | 3a3bcbf775840be34b27523bba9e5ab6321b4ffb (patch) | |
tree | 07469955e8263cd8f59b8506b546c6cc0e117656 /src | |
parent | ca1fd7521e86b016f2aa92048a13a297bab3c074 (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.
Github-Pull: #9052
Rebased-From: d32036a47d9ccdc38628a7a75bb8b711af462e4f
Diffstat (limited to 'src')
-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 faa7b00281..7cb612ee96 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -877,7 +877,7 @@ struct NodeEvictionCandidate int64_t nMinPingUsecTime; int64_t nLastBlockTime; int64_t nLastTXTime; - bool fNetworkNode; + bool fRelevantServices; bool fRelayTxes; bool fBloomFilter; CAddress addr; @@ -902,7 +902,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; } @@ -936,7 +936,8 @@ static bool 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); } |