Fabcoin Core  0.16.2
P2P Digital Currency
fork.cpp
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 */
23 #include <boost/test/unit_test.hpp>
24 #include <boost/filesystem/operations.hpp>
25 
26 #include <libethereum/Client.h>
27 #include <libethereum/BlockChain.h>
29 #include "TestHelper.h"
30 using namespace std;
31 using namespace dev;
32 using namespace dev::eth;
33 
34 // Disabled since tests shouldn't block. Need a short cut to avoid real mining.
35 /*
36 BOOST_AUTO_TEST_CASE(simple_chain_fork)
37 {
38  //start a client and mine a short chain
39  Client c1("TestClient1", KeyPair::create().address(),
40  (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
41  mine(c1, 4);
42 
43  //start another client and mine a longer chain
44  Client c2("TestClient2", KeyPair::create().address(),
45  (boost::filesystem::temp_directory_path() / boost::filesystem::unique_path()).string());
46  mine(c2, 6);
47 
48  //connect the two clients up to resolve chain
49  c1.startNetwork(20000);
50  c2.startNetwork(21000);
51  c2.connect("127.0.0.1", 20000);
52 
53  //mine an extra block to cement it
54  mine(c1, 1);
55 
56  //check the balances are where they should be
57  //c1's chain should have been clobbered by c2
58  BOOST_REQUIRE(c1.state().balance(c1.address()) == 0);
59  BOOST_REQUIRE(c2.state().balance(c2.address()) > 0);
60 }
61 */
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
std::hash for asio::adress
Definition: Common.h:323
Helper functions to work with json::spirit and test files.