This protect any not-already-protected peers who were the most recent to relay transactions and blocks to us.
This also takes increases the eviction agressiveness by making it willing to disconnect a netgroup with only one member.
This protect any not-already-protected peers who were the most recent to relay transactions and blocks to us.
This also takes increases the eviction agressiveness by making it willing to disconnect a netgroup with only one member.
956+ vEvictionCandidates.erase(vEvictionCandidates.end() - std::min(4, static_cast<int>(vEvictionCandidates.size())), vEvictionCandidates.end());
957+
958+ if (vEvictionCandidates.empty()) return false;
959+
960+ // Protect 4 nodes that most recently sent us blocks.
961+ // An attacker cannot manipulate this metric without performing useful work.
856@@ -852,6 +857,21 @@ static bool ReverseCompareNodeTimeConnected(const NodeEvictionCandidate &a, cons
857 return a.nTimeConnected > b.nTimeConnected;
858 }
859
860+static bool CompareNodeBlockTime(const NodeEvictionCandidate &a, const NodeEvictionCandidate &b)
861+{
862+ if (a.nLastBlockTime != b.nLastBlockTime) return a.nLastBlockTime < b.nLastBlockTime;
858@@ -854,7 +859,22 @@ static bool ReverseCompareNodeTimeConnected(const NodeEvictionCandidate &a, cons
859
860 static bool CompareNetGroupKeyed(const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) {
861 return a.nKeyedNetGroup < b.nKeyedNetGroup;
862-};
863+}
864+
865+static bool CompareNodeBlockTime(const NodeEvictionCandidate &a, const NodeEvictionCandidate &b)
866+{
867+ if (a.nLastBlockTime != b.nLastBlockTime) return a.nLastBlockTime < b.nLastBlockTime;
This protects any not-already-protected peers who were the most
recent four to relay transactions and most recent four to send
blocks to us.
With the latest additions there are enough protective measures that
we can take the training wheels off.