Changeset View
Changeset View
Standalone View
Standalone View
src/test/denialofservice_tests.cpp
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(stale_tip_peer_management) { | ||||
auto connman = std::make_unique<CConnmanTest>(config, 0x1337, 0x1337); | auto connman = std::make_unique<CConnmanTest>(config, 0x1337, 0x1337); | ||||
auto peerLogic = std::make_unique<PeerManager>( | auto peerLogic = std::make_unique<PeerManager>( | ||||
config.GetChainParams(), *connman, nullptr, *m_node.scheduler, | config.GetChainParams(), *connman, nullptr, *m_node.scheduler, | ||||
*m_node.chainman, *m_node.mempool); | *m_node.chainman, *m_node.mempool); | ||||
const Consensus::Params &consensusParams = | const Consensus::Params &consensusParams = | ||||
config.GetChainParams().GetConsensus(); | config.GetChainParams().GetConsensus(); | ||||
constexpr int max_outbound_full_relay = 8; | constexpr int max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS; | ||||
CConnman::Options options; | CConnman::Options options; | ||||
options.nMaxConnections = 125; | options.nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS; | ||||
options.m_max_outbound_full_relay = max_outbound_full_relay; | options.m_max_outbound_full_relay = max_outbound_full_relay; | ||||
options.nMaxFeeler = 1; | options.nMaxFeeler = MAX_FEELER_CONNECTIONS; | ||||
connman->Init(options); | connman->Init(options); | ||||
std::vector<CNode *> vNodes; | std::vector<CNode *> vNodes; | ||||
// Mock some outbound peers | // Mock some outbound peers | ||||
for (int i = 0; i < max_outbound_full_relay; ++i) { | for (int i = 0; i < max_outbound_full_relay; ++i) { | ||||
AddRandomOutboundPeer(config, vNodes, *peerLogic, connman.get()); | AddRandomOutboundPeer(config, vNodes, *peerLogic, connman.get()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |