Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/processor_tests.cpp
// Copyright (c) 2018-2020 The Bitcoin developers | // Copyright (c) 2018-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <avalanche/processor.h> | #include <avalanche/processor.h> | ||||
#include <avalanche/delegationbuilder.h> | #include <avalanche/delegationbuilder.h> | ||||
#include <avalanche/peermanager.h> | #include <avalanche/peermanager.h> | ||||
#include <avalanche/proofbuilder.h> | #include <avalanche/proofbuilder.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <net_processing.h> // For ::PeerManager | #include <net_processing.h> // For ::PeerManager | ||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <util/translation.h> // For bilingual_str | |||||
// D6970 moved LookupBlockIndex from chain.h to validation.h TODO: remove this | // D6970 moved LookupBlockIndex from chain.h to validation.h TODO: remove this | ||||
// when LookupBlockIndex is refactored out of validation | // when LookupBlockIndex is refactored out of validation | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <test/util/setup_common.h> | #include <test/util/setup_common.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | AvalancheTestingSetup() | ||||
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. | ||||
m_processor = std::make_unique<Processor>( | bilingual_str error; | ||||
*m_node.chain, m_node.connman.get(), m_node.peerman.get()); | m_processor = Processor::MakeProcessor(*m_node.args, *m_node.chain, | ||||
m_node.connman.get(), | |||||
m_node.peerman.get(), error); | |||||
BOOST_CHECK(m_processor); | |||||
// The master private key we delegate to. | // The master private key we delegate to. | ||||
masterpriv.MakeNewKey(true); | masterpriv.MakeNewKey(true); | ||||
} | } | ||||
~AvalancheTestingSetup() { m_connman->ClearNodes(); } | ~AvalancheTestingSetup() { m_connman->ClearNodes(); } | ||||
CNode *ConnectNode(ServiceFlags nServices) { | CNode *ConnectNode(ServiceFlags nServices) { | ||||
▲ Show 20 Lines • Show All 872 Lines • Show Last 20 Lines |