MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsEvicted

Function IsEvicted

src/test/net_peer_eviction_tests.cpp:573–581  ·  view source on GitHub ↗

Returns true if any of the node ids in node_ids are selected for eviction.

Source from the content-addressed store, hash-verified

571
572// Returns true if any of the node ids in node_ids are selected for eviction.
573bool IsEvicted(std::vector<NodeEvictionCandidate> candidates, const std::unordered_set<NodeId>& node_ids, FastRandomContext& random_context)
574{
575 Shuffle(candidates.begin(), candidates.end(), random_context);
576 const std::optional<NodeId> evicted_node_id = SelectNodeToEvict(std::move(candidates));
577 if (!evicted_node_id) {
578 return false;
579 }
580 return node_ids.count(*evicted_node_id);
581}
582
583// Create number_of_nodes random nodes, apply setup function candidate_setup_fn,
584// apply eviction logic and then return true if any of the node ids in node_ids

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 6

SelectNodeToEvictFunction · 0.85
countMethod · 0.80
ShuffleFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected