// // Unit tests for block-chain checkpoints // #include // for 'map_list_of()' #include #include #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()