// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once #include "TestNode.h" #include "NetworkConfiguration.h" #include #include #include #include namespace CryptoNote { class core; class CryptoNoteProtocolHandler; class NodeServer; class Currency; } namespace Tests { class InProcTestNode : public TestNode { public: InProcTestNode(const TestNodeConfiguration& cfg, const CryptoNote::Currency& currency); ~InProcTestNode(); virtual bool startMining(size_t threadsCount, const std::string &address) override; virtual bool stopMining() override; virtual bool stopDaemon() override; virtual bool getBlockTemplate(const std::string &minerAddress, CryptoNote::Block &blockTemplate, uint64_t &difficulty) override; virtual bool submitBlock(const std::string& block) override; virtual bool getTailBlockId(Crypto::Hash &tailBlockId) override; virtual bool makeINode(std::unique_ptr& node) override; virtual uint64_t getLocalHeight() override; private: void workerThread(std::promise& initPromise); std::unique_ptr core; std::unique_ptr protocol; std::unique_ptr p2pNode; std::thread m_thread; const CryptoNote::Currency& m_currency; TestNodeConfiguration m_cfg; }; }