Fabcoin Core  0.16.2
P2P Digital Currency
BlockChainLoader.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 #include <string>
24 #include <json/json.h>
26 #include <libethereum/BlockChain.h>
27 #include <libethereum/Block.h>
29 
30 namespace dev
31 {
32 namespace test
33 {
34 
40 {
41 public:
43  eth::BlockChain const& bc() const { return *m_bc; }
44  eth::State const& state() const { return m_block.state(); } // TODO remove?
45  eth::Block const& block() const { return m_block; }
46 
47 private:
49  std::unique_ptr<eth::BlockChain> m_bc;
51 };
52 
53 }
54 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
State const & state() const
Get the backing state object.
Definition: Block.h:163
Implements the blockchain database.
Definition: BlockChain.h:105
Network
The network id.
Definition: GenesisInfo.h:34
eth::BlockChain const & bc() const
Normal Frontier/Homestead/DAO/EIP150/EIP158 chain without all the premine.
Model of an Ethereum state, essentially a facade for the trie.
Definition: State.h:161
Active model of a block within the block chain.
Definition: Block.h:73
Config::Value_type Value
Should be used to load test blockchain from json file Loads the blockchain from json, creates temporary directory to store it, removes the directory on dealloc.
eth::State const & state() const
eth::Block const & block() const
BlockChainLoader(Json::Value const &_json, eth::Network _sealEngineNetwork=eth::Network::TransitionnetTest)
std::unique_ptr< eth::BlockChain > m_bc
temporary directory implementation It creates temporary directory in the given path.