Allow disconnecting a netgroup with only one member in eviction.

With the latest additions there are enough protective measures that
 we can take the training wheels off.
This commit is contained in:
Gregory Maxwell 2016-06-10 03:02:01 +00:00
parent 5d0ca81f74
commit 6ee7f05622

View file

@ -965,13 +965,6 @@ static bool AttemptToEvictConnection() {
// Reduce to the network group with the most connections // Reduce to the network group with the most connections
vEvictionCandidates = std::move(mapAddrCounts[naMostConnections]); vEvictionCandidates = std::move(mapAddrCounts[naMostConnections]);
// Do not disconnect peers if there is only one unprotected connection from their network group.
// This step excessively favors netgroup diversity, and should be removed once more protective criteria are established.
if (vEvictionCandidates.size() <= 1)
// unless we prefer the new connection (for whitelisted peers)
if (!fPreferNewConnection)
return false;
// Disconnect from the network group with the most connections // Disconnect from the network group with the most connections
NodeId evicted = vEvictionCandidates.front().id; NodeId evicted = vEvictionCandidates.front().id;
LOCK(cs_vNodes); LOCK(cs_vNodes);