Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Checkpoints_tests.cpp
Go to the documentation of this file.
1 //
2 // Unit tests for block-chain checkpoints
3 //
4 #include <boost/assign/list_of.hpp> // for 'map_list_of()'
5 #include <boost/test/unit_test.hpp>
6 #include <boost/foreach.hpp>
7 
8 #include "../checkpoints.h"
9 #include "../util.h"
10 
11 using namespace std;
12 
13 BOOST_AUTO_TEST_SUITE(Checkpoints_tests)
14 
16 {
17  uint256 p1500 = uint256("0x841a2965955dd288cfa707a755d05a54e45f8bd476835ec9af4402a2b59a2967");
18  uint256 p120000 = uint256("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131");
19  BOOST_CHECK(Checkpoints::CheckBlock(1500, p1500));
20  BOOST_CHECK(Checkpoints::CheckBlock(120000, p120000));
21 
22 
23  // Wrong hashes at checkpoints should fail:
24  BOOST_CHECK(!Checkpoints::CheckBlock(1500, p120000));
25  BOOST_CHECK(!Checkpoints::CheckBlock(120000, p1500));
26 
27  // ... but any hash not at a checkpoint should succeed:
28  BOOST_CHECK(Checkpoints::CheckBlock(1500+1, p120000));
29  BOOST_CHECK(Checkpoints::CheckBlock(120000+1, p1500));
30 
31  BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 120000);
32 }
33 
34 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(sanity)
int GetTotalBlocksEstimate()
bool CheckBlock(int nHeight, const uint256 &hash)
Definition: checkpoints.cpp:61
256-bit unsigned integer
Definition: uint256.h:537