mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
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>
This commit is contained in:
parent
f66eceaecf
commit
1cde800523
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user