mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
p2p: process more candidates per protection iteration
for the usual case when some of the protected networks don't have eviction candidates, to reduce the number of iterations in ProtectEvictionCandidatesByRatio(). Picks up an idea in ef411cd2 that I had dropped.
This commit is contained in:
parent
02e411ec45
commit
c9e8d8f9b1
1 changed files with 1 additions and 3 deletions
|
@ -940,9 +940,7 @@ void ProtectEvictionCandidatesByRatio(std::vector<NodeEvictionCandidate>& evicti
|
|||
|
||||
while (num_networks != 0 && num_protected < max_protect_by_network) {
|
||||
const size_t disadvantaged_to_protect{max_protect_by_network - num_protected};
|
||||
const size_t protect_per_network{
|
||||
std::max(disadvantaged_to_protect / networks.size(), static_cast<size_t>(1))};
|
||||
|
||||
const size_t protect_per_network{std::max(disadvantaged_to_protect / num_networks, static_cast<size_t>(1))};
|
||||
// Early exit flag if there are no remaining candidates by disadvantaged network.
|
||||
bool protected_at_least_one{false};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue