aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-04-10 18:05:47 +0200
committerJon Atack <jon@atack.com>2021-06-11 12:26:59 +0200
commit1cde8005233d163723d4d5bf1bacf22e6cb7a07e (patch)
tree5724bbaa1b931f88f9053225f61836d0dc9f5790 /src
parentf66eceaecf464bfab5e19f3ca8fe680d8a6aa2e1 (diff)
p2p, refactor: rm redundant erase_size calculation in SelectNodeToEvict()
as EraseLastKElements() called in the next line performs the same operation. Thanks to Martin Zumsande (lightlike) for seeing this while reviewing. Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 6f9f17ed4e..901132daa3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -944,8 +944,7 @@ void ProtectEvictionCandidatesByRatio(std::vector<NodeEvictionCandidate>& vEvict
// An attacker cannot manipulate this metric without performing useful work.
EraseLastKElements(vEvictionCandidates, CompareNodeTXTime, 4);
// Protect up to 8 non-tx-relay peers that have sent us novel blocks.
- const size_t erase_size = std::min(size_t(8), vEvictionCandidates.size());
- EraseLastKElements(vEvictionCandidates, CompareNodeBlockRelayOnlyTime, erase_size,
+ EraseLastKElements(vEvictionCandidates, CompareNodeBlockRelayOnlyTime, 8,
[](const NodeEvictionCandidate& n) { return !n.fRelayTxes && n.fRelevantServices; });
// Protect 4 nodes that most recently sent us novel blocks.