2016-01-18 15:33:29 +00:00
|
|
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
2015-04-23 16:07:22 +00:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <System/Dispatcher.h>
|
|
|
|
#include "HTTP/HttpRequest.h"
|
|
|
|
#include "HTTP/HttpResponse.h"
|
2015-07-30 15:22:07 +00:00
|
|
|
#include "Rpc/HttpClient.h"
|
2015-04-23 16:07:22 +00:00
|
|
|
|
|
|
|
#include "TestNode.h"
|
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
using namespace CryptoNote;
|
2015-04-23 16:07:22 +00:00
|
|
|
|
|
|
|
namespace Tests {
|
2015-07-30 15:22:07 +00:00
|
|
|
class RPCTestNode : public TestNode {
|
2015-04-23 16:07:22 +00:00
|
|
|
public:
|
2015-07-30 15:22:07 +00:00
|
|
|
RPCTestNode(uint16_t port, System::Dispatcher& d);
|
|
|
|
|
2015-04-23 16:07:22 +00:00
|
|
|
virtual bool startMining(size_t threadsCount, const std::string& address) override;
|
|
|
|
virtual bool stopMining() override;
|
|
|
|
virtual bool stopDaemon() override;
|
2015-07-30 15:22:07 +00:00
|
|
|
virtual bool getBlockTemplate(const std::string& minerAddress, CryptoNote::Block& blockTemplate, uint64_t& difficulty) override;
|
2015-04-23 16:07:22 +00:00
|
|
|
virtual bool submitBlock(const std::string& block) override;
|
2015-07-30 15:22:07 +00:00
|
|
|
virtual bool getTailBlockId(Crypto::Hash& tailBlockId) override;
|
2015-04-23 16:07:22 +00:00
|
|
|
virtual bool makeINode(std::unique_ptr<CryptoNote::INode>& node) override;
|
2015-07-30 15:22:07 +00:00
|
|
|
virtual uint64_t getLocalHeight() override;
|
|
|
|
|
2015-04-23 16:07:22 +00:00
|
|
|
virtual ~RPCTestNode() { }
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
uint16_t m_rpcPort;
|
|
|
|
System::Dispatcher& m_dispatcher;
|
2015-07-30 15:22:07 +00:00
|
|
|
CryptoNote::HttpClient m_httpClient;
|
2015-04-23 16:07:22 +00:00
|
|
|
};
|
|
|
|
}
|