aboutsummaryrefslogtreecommitdiff
path: root/src/test/net_peer_eviction_tests.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-07-01 12:48:51 +0200
committerJon Atack <jon@atack.com>2021-07-06 17:28:15 +0200
commit566357f8f7471f74729297868917aa32f6d3c390 (patch)
tree1ae0de3c612f40af7af9cbc76adc88f6935ec48f /src/test/net_peer_eviction_tests.cpp
parent088b348dbe82689ce1782653c8fdcebb3b636eb5 (diff)
downloadbitcoin-566357f8f7471f74729297868917aa32f6d3c390.tar.xz
refactor: move GetRandomNodeEvictionCandidates() to test utilities
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
Diffstat (limited to 'src/test/net_peer_eviction_tests.cpp')
-rw-r--r--src/test/net_peer_eviction_tests.cpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/test/net_peer_eviction_tests.cpp b/src/test/net_peer_eviction_tests.cpp
index 4bfd487b86..5eb280b498 100644
--- a/src/test/net_peer_eviction_tests.cpp
+++ b/src/test/net_peer_eviction_tests.cpp
@@ -17,28 +17,6 @@
BOOST_FIXTURE_TEST_SUITE(net_peer_eviction_tests, BasicTestingSetup)
-std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(const int n_candidates, FastRandomContext& random_context)
-{
- std::vector<NodeEvictionCandidate> candidates;
- for (int id = 0; id < n_candidates; ++id) {
- candidates.push_back({
- /* id */ id,
- /* nTimeConnected */ static_cast<int64_t>(random_context.randrange(100)),
- /* m_min_ping_time */ std::chrono::microseconds{random_context.randrange(100)},
- /* nLastBlockTime */ static_cast<int64_t>(random_context.randrange(100)),
- /* nLastTXTime */ static_cast<int64_t>(random_context.randrange(100)),
- /* fRelevantServices */ random_context.randbool(),
- /* fRelayTxes */ random_context.randbool(),
- /* fBloomFilter */ random_context.randbool(),
- /* nKeyedNetGroup */ random_context.randrange(100),
- /* prefer_evict */ random_context.randbool(),
- /* m_is_local */ random_context.randbool(),
- /* m_network */ ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
- });
- }
- return candidates;
-}
-
// Create `num_peers` random nodes, apply setup function `candidate_setup_fn`,
// call ProtectEvictionCandidatesByRatio() to apply protection logic, and then
// return true if all of `protected_peer_ids` and none of `unprotected_peer_ids`