0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00

p2p: remove unused m_is_onion member from NodeEvictionCandidate struct

This commit is contained in:
Jon Atack 2021-06-11 11:54:08 +02:00
parent 310fab4928
commit 045cb40192
No known key found for this signature in database
GPG key ID: 4F5721B3D0E3921D
4 changed files with 3 additions and 8 deletions

View file

@ -1063,7 +1063,7 @@ bool CConnman::AttemptToEvictConnection()
HasAllDesirableServiceFlags(node->nServices), HasAllDesirableServiceFlags(node->nServices),
peer_relay_txes, peer_filter_not_null, node->nKeyedNetGroup, peer_relay_txes, peer_filter_not_null, node->nKeyedNetGroup,
node->m_prefer_evict, node->addr.IsLocal(), node->m_prefer_evict, node->addr.IsLocal(),
node->m_inbound_onion, node->ConnectedThroughNetwork()}; node->ConnectedThroughNetwork()};
vEvictionCandidates.push_back(candidate); vEvictionCandidates.push_back(candidate);
} }
} }

View file

@ -1209,7 +1209,6 @@ struct NodeEvictionCandidate
uint64_t nKeyedNetGroup; uint64_t nKeyedNetGroup;
bool prefer_evict; bool prefer_evict;
bool m_is_local; bool m_is_local;
bool m_is_onion;
Network m_network; Network m_network;
}; };

View file

@ -31,7 +31,6 @@ FUZZ_TARGET(node_eviction)
/* nKeyedNetGroup */ fuzzed_data_provider.ConsumeIntegral<uint64_t>(), /* nKeyedNetGroup */ fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
/* prefer_evict */ fuzzed_data_provider.ConsumeBool(), /* prefer_evict */ fuzzed_data_provider.ConsumeBool(),
/* m_is_local */ fuzzed_data_provider.ConsumeBool(), /* m_is_local */ fuzzed_data_provider.ConsumeBool(),
/* m_is_onion */ fuzzed_data_provider.ConsumeBool(),
/* m_network */ fuzzed_data_provider.PickValueInArray(ALL_NETWORKS), /* m_network */ fuzzed_data_provider.PickValueInArray(ALL_NETWORKS),
}); });
} }

View file

@ -33,7 +33,6 @@ std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(const int n_c
/* nKeyedNetGroup */ random_context.randrange(100), /* nKeyedNetGroup */ random_context.randrange(100),
/* prefer_evict */ random_context.randbool(), /* prefer_evict */ random_context.randbool(),
/* m_is_local */ random_context.randbool(), /* m_is_local */ random_context.randbool(),
/* m_is_onion */ random_context.randbool(),
/* m_network */ ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())], /* m_network */ ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
}); });
} }
@ -92,7 +91,7 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
BOOST_CHECK(IsProtected( BOOST_CHECK(IsProtected(
num_peers, [](NodeEvictionCandidate& c) { num_peers, [](NodeEvictionCandidate& c) {
c.nTimeConnected = c.id; c.nTimeConnected = c.id;
c.m_is_onion = c.m_is_local = false; c.m_is_local = false;
c.m_network = NET_IPV4; c.m_network = NET_IPV4;
}, },
/* protected_peer_ids */ {0, 1, 2, 3, 4, 5}, /* protected_peer_ids */ {0, 1, 2, 3, 4, 5},
@ -103,7 +102,7 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
BOOST_CHECK(IsProtected( BOOST_CHECK(IsProtected(
num_peers, [num_peers](NodeEvictionCandidate& c) { num_peers, [num_peers](NodeEvictionCandidate& c) {
c.nTimeConnected = num_peers - c.id; c.nTimeConnected = num_peers - c.id;
c.m_is_onion = c.m_is_local = false; c.m_is_local = false;
c.m_network = NET_IPV6; c.m_network = NET_IPV6;
}, },
/* protected_peer_ids */ {6, 7, 8, 9, 10, 11}, /* protected_peer_ids */ {6, 7, 8, 9, 10, 11},
@ -139,7 +138,6 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
// if no onion peers. // if no onion peers.
BOOST_CHECK(IsProtected( BOOST_CHECK(IsProtected(
num_peers, [](NodeEvictionCandidate& c) { num_peers, [](NodeEvictionCandidate& c) {
c.m_is_onion = false;
c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11); c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11);
c.m_network = NET_IPV4; c.m_network = NET_IPV4;
}, },
@ -152,7 +150,6 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
BOOST_CHECK(IsProtected( BOOST_CHECK(IsProtected(
num_peers, [](NodeEvictionCandidate& c) { num_peers, [](NodeEvictionCandidate& c) {
c.nTimeConnected = c.id; c.nTimeConnected = c.id;
c.m_is_onion = false;
c.m_is_local = (c.id > 6); c.m_is_local = (c.id > 6);
c.m_network = NET_IPV6; c.m_network = NET_IPV6;
}, },