Fabcoin Core  0.16.2
P2P Digital Currency
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 
27 namespace dev
28 {
29 namespace eth
30 {
31 
32 DEV_SIMPLE_EXCEPTION(ChainParamsInvalid);
33 DEV_SIMPLE_EXCEPTION(ChainParamsNotNoProof);
34 
35 class ClientTest: public Client
36 {
37 public:
39  ClientTest(
40  ChainParams const& _params,
41  int _networkID,
42  p2p::Host* _host,
43  std::shared_ptr<GasPricer> _gpForAdoption,
44  std::string const& _dbPath = std::string(),
45  WithExisting _forceAction = WithExisting::Trust,
47  );
48 
49  void setChainParams(std::string const& _genesis);
50  void mineBlocks(unsigned _count);
51  void modifyTimestamp(u256 const& _timestamp);
52  void rewindToBlock(unsigned _number);
53  bool addBlock(std::string const& _rlp);
54  bool completeSync();
55 
56 protected:
57  unsigned m_blocksToMine;
58  virtual void onNewBlocks(h256s const& _blocks, h256Hash& io_changed) override;
59 };
60 
63 
64 }
65 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
void modifyTimestamp(u256 const &_timestamp)
Definition: ClientTest.cpp:80
The Host class Capabilities should be registered prior to startNetwork, since m_capabilities is not t...
Definition: Host.h:129
bool addBlock(std::string const &_rlp)
Definition: ClientTest.cpp:70
void mineBlocks(unsigned _count)
Definition: ClientTest.cpp:106
WithExisting
Definition: Common.h:310
ClientTest & asClientTest(Interface &_c)
Definition: ClientTest.cpp:30
ClientTest(ChainParams const &_params, int _networkID, p2p::Host *_host, std::shared_ptr< GasPricer > _gpForAdoption, std::string const &_dbPath=std::string(), WithExisting _forceAction=WithExisting::Trust, TransactionQueue::Limits const &_l=TransactionQueue::Limits{1024, 1024})
Trivial forwarding constructor.
Definition: ClientTest.cpp:40
virtual void onNewBlocks(h256s const &_blocks, h256Hash &io_changed) override
Called on chain changes.
Definition: ClientTest.cpp:112
void rewindToBlock(unsigned _number)
Main API hub for interfacing with Ethereum.
Definition: Client.h:75
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Definition: Common.h:125
Main API hub for interfacing with Ethereum.
Definition: Interface.h:67
std::unordered_set< h256 > h256Hash
Definition: FixedHash.h:349
unsigned m_blocksToMine
Definition: ClientTest.h:57
std::vector< h256 > h256s
Definition: FixedHash.h:345
DEV_SIMPLE_EXCEPTION(InvalidSealEngine)
void setChainParams(std::string const &_genesis)
Definition: ClientTest.cpp:52