Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.cpp
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName) | ||||
m_node.banman = | m_node.banman = | ||||
std::make_unique<BanMan>(GetDataDir() / "banlist.dat", chainparams, | std::make_unique<BanMan>(GetDataDir() / "banlist.dat", chainparams, | ||||
nullptr, DEFAULT_MISBEHAVING_BANTIME); | nullptr, DEFAULT_MISBEHAVING_BANTIME); | ||||
// Deterministic randomness for tests. | // Deterministic randomness for tests. | ||||
m_node.connman = std::make_unique<CConnman>(config, 0x1337, 0x1337); | m_node.connman = std::make_unique<CConnman>(config, 0x1337, 0x1337); | ||||
m_node.peer_logic = std::make_unique<PeerLogicValidation>( | m_node.peer_logic = std::make_unique<PeerLogicValidation>( | ||||
m_node.connman.get(), m_node.banman.get(), *m_node.scheduler, | m_node.connman.get(), m_node.banman.get(), *m_node.scheduler, | ||||
*m_node.chainman); | *m_node.chainman); | ||||
{ | |||||
CConnman::Options options; | |||||
options.m_msgproc = m_node.peer_logic.get(); | |||||
m_node.connman->Init(options); | |||||
} | |||||
} | } | ||||
TestingSetup::~TestingSetup() { | TestingSetup::~TestingSetup() { | ||||
if (m_node.scheduler) { | if (m_node.scheduler) { | ||||
m_node.scheduler->stop(); | m_node.scheduler->stop(); | ||||
} | } | ||||
threadGroup.interrupt_all(); | threadGroup.interrupt_all(); | ||||
threadGroup.join_all(); | threadGroup.join_all(); | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |