-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckpoints_tests.cpp
More file actions
executable file
·34 lines (25 loc) · 1.06 KB
/
Checkpoints_tests.cpp
File metadata and controls
executable file
·34 lines (25 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Unit tests for block-chain checkpoints
//
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/test/unit_test.hpp>
#include <boost/foreach.hpp>
#include "../checkpoints.h"
#include "../util.h"
using namespace std;
BOOST_AUTO_TEST_SUITE(Checkpoints_tests)
BOOST_AUTO_TEST_CASE(sanity)
{
uint256 p1500 = uint256("0x841a2965955dd288cfa707a755d05a54e45f8bd476835ec9af4402a2b59a2967");
uint256 p120000 = uint256("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131");
BOOST_CHECK(Checkpoints::CheckBlock(1500, p1500));
BOOST_CHECK(Checkpoints::CheckBlock(120000, p120000));
// Wrong hashes at checkpoints should fail:
BOOST_CHECK(!Checkpoints::CheckBlock(1500, p120000));
BOOST_CHECK(!Checkpoints::CheckBlock(120000, p1500));
// ... but any hash not at a checkpoint should succeed:
BOOST_CHECK(Checkpoints::CheckBlock(1500+1, p120000));
BOOST_CHECK(Checkpoints::CheckBlock(120000+1, p1500));
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 120000);
}
BOOST_AUTO_TEST_SUITE_END()