Ethereum  PoC-8
The C++ Implementation of Ethereum
ClientTest.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
22 #pragma once
23 
24 #include <tuple>
25 #include <libethereum/Client.h>
26 #include <boost/filesystem/path.hpp>
27 
28 namespace dev
29 {
30 namespace eth
31 {
32 
33 DEV_SIMPLE_EXCEPTION(ChainParamsInvalid);
34 DEV_SIMPLE_EXCEPTION(ImportBlockFailed);
35 
36 class ClientTest: public Client
37 {
38 public:
40  ClientTest(ChainParams const& _params, int _networkID, p2p::Host& _host,
41  std::shared_ptr<GasPricer> _gpForAdoption,
42  boost::filesystem::path const& _dbPath = boost::filesystem::path(),
43  WithExisting _forceAction = WithExisting::Trust,
44  TransactionQueue::Limits const& _l = TransactionQueue::Limits{1024, 1024});
45  ~ClientTest();
46 
47  void setChainParams(std::string const& _genesis);
48  bool mineBlocks(unsigned _count) noexcept;
49  void modifyTimestamp(int64_t _timestamp);
50  void rewindToBlock(unsigned _number);
51  h256 importRawBlock(std::string const& _blockRLP);
52  bool completeSync();
53 
54 protected:
56 };
57 
60 
61 }
62 }
dev::eth::ClientTest::setChainParams
void setChainParams(std::string const &_genesis)
Definition: ClientTest.cpp:58
dev::eth::ClientTest::modifyTimestamp
void modifyTimestamp(int64_t _timestamp)
Definition: ClientTest.cpp:76
dev::eth::ClientTest::importRawBlock
h256 importRawBlock(std::string const &_blockRLP)
Definition: ClientTest.cpp:146
dev::eth::ChainParams
Definition: ChainParams.h:38
dev::eth::ClientTest::completeSync
bool completeSync()
Definition: ClientTest.cpp:136
dev::eth::ClientTest::m_singleBlockMaxMiningTimeInSeconds
unsigned const m_singleBlockMaxMiningTimeInSeconds
Definition: ClientTest.h:55
dev::eth::ClientTest::rewindToBlock
void rewindToBlock(unsigned _number)
dev::FixedHash< 32 >
dev::WithExisting
WithExisting
Definition: Common.h:292
dev::WithExisting::Trust
@ Trust
dev::eth::TransactionQueue::Limits
Definition: TransactionQueue.h:47
dev::eth::Client
Main API hub for interfacing with Ethereum.
Definition: Client.h:77
Client.h
dev::eth::ClientTest
Definition: ClientTest.h:37
dev::eth::Interface
Main API hub for interfacing with Ethereum.
Definition: Interface.h:68
dev::eth::ClientTest::~ClientTest
~ClientTest()
Definition: ClientTest.cpp:52
dev::eth::DEV_SIMPLE_EXCEPTION
DEV_SIMPLE_EXCEPTION(NoHashRecorded)
dev::eth::ClientTest::mineBlocks
bool mineBlocks(unsigned _count) noexcept
Definition: ClientTest.cpp:103
dev
Definition: Address.cpp:21
dev::eth::ClientTest::ClientTest
ClientTest(ChainParams const &_params, int _networkID, p2p::Host &_host, std::shared_ptr< GasPricer > _gpForAdoption, boost::filesystem::path const &_dbPath=boost::filesystem::path(), WithExisting _forceAction=WithExisting::Trust, TransactionQueue::Limits const &_l=TransactionQueue::Limits{1024, 1024})
Trivial forwarding constructor.
Definition: ClientTest.cpp:45
dev::eth::asClientTest
ClientTest & asClientTest(Interface &_c)
Definition: ClientTest.cpp:35