mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
test: remove combined onion/localhost eviction protection tests
as we are about the change the behavior sufficiently that when we have multiple disadvantaged networks and a small number of peers under test, the number of protected peers per network can be different.
This commit is contained in:
parent
38a81a8e20
commit
3f8105c4d2
1 changed files with 0 additions and 72 deletions
|
@ -154,78 +154,6 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
|
|||
/* protected_peer_ids */ {0, 1, 2, 7, 8, 9},
|
||||
/* unprotected_peer_ids */ {3, 4, 5, 6, 10, 11},
|
||||
random_context));
|
||||
|
||||
// Combined test: expect 1/4 onion and 2 localhost peers to be protected
|
||||
// from eviction, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
num_peers, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id == 0 || c.id == 5 || c.id == 10);
|
||||
c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11);
|
||||
},
|
||||
/* protected_peer_ids */ {0, 1, 2, 5, 9, 10},
|
||||
/* unprotected_peer_ids */ {3, 4, 6, 7, 8, 11},
|
||||
random_context));
|
||||
|
||||
// Combined test: expect having only 1 onion to allow allocating the
|
||||
// remaining 2 of the 1/4 to localhost peers, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
num_peers + 4, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id == 15);
|
||||
c.m_is_local = (c.id > 6 && c.id < 11);
|
||||
},
|
||||
/* protected_peer_ids */ {0, 1, 2, 3, 7, 8, 9, 15},
|
||||
/* unprotected_peer_ids */ {4, 5, 6, 10, 11, 12, 13, 14},
|
||||
random_context));
|
||||
|
||||
// Combined test: expect 2 onions (< 1/4) to allow allocating the minimum 2
|
||||
// localhost peers, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
num_peers, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id == 7 || c.id == 9);
|
||||
c.m_is_local = (c.id == 6 || c.id == 11);
|
||||
},
|
||||
/* protected_peer_ids */ {0, 1, 6, 7, 9, 11},
|
||||
/* unprotected_peer_ids */ {2, 3, 4, 5, 8, 10},
|
||||
random_context));
|
||||
|
||||
// Combined test: when > 1/4, expect max 1/4 onion and 2 localhost peers
|
||||
// to be protected from eviction, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
num_peers, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id > 3 && c.id < 8);
|
||||
c.m_is_local = (c.id > 7);
|
||||
},
|
||||
/* protected_peer_ids */ {0, 4, 5, 6, 8, 9},
|
||||
/* unprotected_peer_ids */ {1, 2, 3, 7, 10, 11},
|
||||
random_context));
|
||||
|
||||
// Combined test: idem > 1/4 with only 8 peers: expect 2 onion and 2
|
||||
// localhost peers (1/4 + 2) to be protected, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
8, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id > 1 && c.id < 5);
|
||||
c.m_is_local = (c.id > 4);
|
||||
},
|
||||
/* protected_peer_ids */ {2, 3, 5, 6},
|
||||
/* unprotected_peer_ids */ {0, 1, 4, 7},
|
||||
random_context));
|
||||
|
||||
// Combined test: idem > 1/4 with only 6 peers: expect 1 onion peer and no
|
||||
// localhost peers (1/4 + 0) to be protected, sorted by longest uptime.
|
||||
BOOST_CHECK(IsProtected(
|
||||
6, [](NodeEvictionCandidate& c) {
|
||||
c.nTimeConnected = c.id;
|
||||
c.m_is_onion = (c.id == 4 || c.id == 5);
|
||||
c.m_is_local = (c.id == 3);
|
||||
},
|
||||
/* protected_peer_ids */ {0, 1, 4},
|
||||
/* unprotected_peer_ids */ {2, 3, 5},
|
||||
random_context));
|
||||
}
|
||||
|
||||
// Returns true if any of the node ids in node_ids are selected for eviction.
|
||||
|
|
Loading…
Add table
Reference in a new issue