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

Function GetRandomNodeEvictionCandidates

src/test/util/net.cpp:44–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext& random_context)
45{
46 std::vector<NodeEvictionCandidate> candidates;
47 for (int id = 0; id < n_candidates; ++id) {
48 candidates.push_back({
49 /*id=*/id,
50 /*m_connected=*/std::chrono::seconds{random_context.randrange(100)},
51 /*m_min_ping_time=*/std::chrono::microseconds{random_context.randrange(100)},
52 /*m_last_block_time=*/std::chrono::seconds{random_context.randrange(100)},
53 /*m_last_tx_time=*/std::chrono::seconds{random_context.randrange(100)},
54 /*fRelevantServices=*/random_context.randbool(),
55 /*fRelayTxes=*/random_context.randbool(),
56 /*fBloomFilter=*/random_context.randbool(),
57 /*nKeyedNetGroup=*/random_context.randrange(100),
58 /*prefer_evict=*/random_context.randbool(),
59 /*m_is_local=*/random_context.randbool(),
60 /*m_network=*/ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
61 });
62 }
63 return candidates;
64}

Callers 4

IsProtectedFunction · 0.85
IsEvictedFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
EvictionProtectionCommonFunction · 0.85

Calls 4

randrangeMethod · 0.80
randboolMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected