Changeset View
Changeset View
Standalone View
Standalone View
src/test/net_peer_eviction_tests.cpp
Show First 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | for (int i = 0; i < NODE_EVICTION_TEST_ROUNDS; ++i) { | ||||
std::vector<NodeId> protectedNodes(128); | std::vector<NodeId> protectedNodes(128); | ||||
std::iota(protectedNodes.begin(), protectedNodes.end(), 0); | std::iota(protectedNodes.begin(), protectedNodes.end(), 0); | ||||
BOOST_CHECK(!IsEvicted( | BOOST_CHECK(!IsEvicted( | ||||
number_of_nodes, | number_of_nodes, | ||||
[number_of_nodes](NodeEvictionCandidate &candidate) { | [number_of_nodes](NodeEvictionCandidate &candidate) { | ||||
candidate.availabilityScore = | candidate.availabilityScore = | ||||
double(number_of_nodes - candidate.id); | double(number_of_nodes - candidate.id); | ||||
}, | }, | ||||
std::unordered_set(protectedNodes.begin(), | std::unordered_set<NodeId>(protectedNodes.begin(), | ||||
protectedNodes.end()), | protectedNodes.end()), | ||||
random_context)); | random_context)); | ||||
// An eviction is expected given >= 161 random eviction candidates. | // An eviction is expected given >= 161 random eviction candidates. | ||||
// The eviction logic protects at most four peers by net group, | // The eviction logic protects at most four peers by net group, | ||||
// eight by lowest ping time, four by last time of novel tx, four by | // eight by lowest ping time, four by last time of novel tx, four by | ||||
// last time of novel proof, up to eight non-tx-relay peers by last | // last time of novel proof, up to eight non-tx-relay peers by last | ||||
// novel block time, four by last novel block time, and 128 more by | // novel block time, four by last novel block time, and 128 more by | ||||
// avalanche availability score. | // avalanche availability score. | ||||
Show All 24 Lines |