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: d32036a47d
This commit is contained in:
parent
ca1fd7521e
commit
3a3bcbf775
|
@ -877,7 +877,7 @@ struct NodeEvictionCandidate
|
||||||
int64_t nMinPingUsecTime;
|
int64_t nMinPingUsecTime;
|
||||||
int64_t nLastBlockTime;
|
int64_t nLastBlockTime;
|
||||||
int64_t nLastTXTime;
|
int64_t nLastTXTime;
|
||||||
bool fNetworkNode;
|
bool fRelevantServices;
|
||||||
bool fRelayTxes;
|
bool fRelayTxes;
|
||||||
bool fBloomFilter;
|
bool fBloomFilter;
|
||||||
CAddress addr;
|
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.
|
// 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.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;
|
return a.nTimeConnected > b.nTimeConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,7 +936,8 @@ static bool AttemptToEvictConnection() {
|
||||||
if (node->fDisconnect)
|
if (node->fDisconnect)
|
||||||
continue;
|
continue;
|
||||||
NodeEvictionCandidate candidate = {node->id, node->nTimeConnected, node->nMinPingUsecTime,
|
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};
|
node->fRelayTxes, node->pfilter != NULL, node->addr, node->nKeyedNetGroup};
|
||||||
vEvictionCandidates.push_back(candidate);
|
vEvictionCandidates.push_back(candidate);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue