net, refactor: move calculations for connection type limits into connman

Currently the logic is fragmented between init and connman. Encapsulating this
logic within connman allows for less mental overhead and easier reuse in tests.

Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
Amiti Uttarwar
2023-08-31 13:40:37 -07:00
committed by Martin Zumsande
parent 97f756b12c
commit c25e0e0555
3 changed files with 5 additions and 19 deletions

View File

@@ -148,8 +148,6 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
constexpr int max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS;
CConnman::Options options;
options.nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS;
options.m_max_outbound_full_relay = max_outbound_full_relay;
options.nMaxFeeler = MAX_FEELER_CONNECTIONS;
const auto time_init{GetTime<std::chrono::seconds>()};
SetMockTime(time_init);
@@ -249,8 +247,6 @@ BOOST_AUTO_TEST_CASE(block_relay_only_eviction)
constexpr int64_t MINIMUM_CONNECT_TIME{30};
CConnman::Options options;
options.nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS;
options.m_max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS;
options.m_max_outbound_block_relay = max_outbound_block_relay;
connman->Init(options);
std::vector<CNode*> vNodes;