Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/processor_tests.cpp
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
struct AvalancheTestingSetup : public TestChain100Setup { | struct AvalancheTestingSetup : public TestChain100Setup { | ||||
const Config &config; | const Config &config; | ||||
CConnmanTest *m_connman; | CConnmanTest *m_connman; | ||||
std::unique_ptr<Processor> m_processor; | std::unique_ptr<Processor> m_processor; | ||||
// The master private key we delegate to. | |||||
CKey masterpriv; | CKey masterpriv; | ||||
AvalancheTestingSetup() | AvalancheTestingSetup() | ||||
: TestChain100Setup(), config(GetConfig()), masterpriv() { | : TestChain100Setup(), config(GetConfig()), | ||||
masterpriv(CKey::MakeCompressedKey()) { | |||||
// Deterministic randomness for tests. | // Deterministic randomness for tests. | ||||
auto connman = std::make_unique<CConnmanTest>(config, 0x1337, 0x1337); | auto connman = std::make_unique<CConnmanTest>(config, 0x1337, 0x1337); | ||||
m_connman = connman.get(); | m_connman = connman.get(); | ||||
m_node.connman = std::move(connman); | m_node.connman = std::move(connman); | ||||
m_node.peerman = std::make_unique<::PeerManager>( | m_node.peerman = std::make_unique<::PeerManager>( | ||||
config.GetChainParams(), *m_connman, m_node.banman.get(), | config.GetChainParams(), *m_connman, m_node.banman.get(), | ||||
*m_node.scheduler, *m_node.chainman, *m_node.mempool); | *m_node.scheduler, *m_node.chainman, *m_node.mempool); | ||||
m_node.chain = interfaces::MakeChain(m_node, config.GetChainParams()); | m_node.chain = interfaces::MakeChain(m_node, config.GetChainParams()); | ||||
// Get the processor ready. | // Get the processor ready. | ||||
bilingual_str error; | bilingual_str error; | ||||
m_processor = Processor::MakeProcessor(*m_node.args, *m_node.chain, | m_processor = Processor::MakeProcessor(*m_node.args, *m_node.chain, | ||||
m_node.connman.get(), error); | m_node.connman.get(), error); | ||||
BOOST_CHECK(m_processor); | BOOST_CHECK(m_processor); | ||||
// The master private key we delegate to. | |||||
masterpriv.MakeNewKey(true); | |||||
} | } | ||||
~AvalancheTestingSetup() { | ~AvalancheTestingSetup() { | ||||
m_connman->ClearNodes(); | m_connman->ClearNodes(); | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
} | } | ||||
CNode *ConnectNode(ServiceFlags nServices) { | CNode *ConnectNode(ServiceFlags nServices) { | ||||
▲ Show 20 Lines • Show All 888 Lines • Show Last 20 Lines |