-
+ E067EDB9BA652729FF0A427FE7E8817AA741A011A640F2CA72242AC94E5E99FB650D68CF79109050B2796FC846EA3E912C7C2B3BBC3AEB6D1FE72459652F4BD7
bitcoin/src/test/Checkpoints_tests.cpp
(0 . 0)(1 . 34)
21048 //
21049 // Unit tests for block-chain checkpoints
21050 //
21051 #include <boost/assign/list_of.hpp> // for 'map_list_of()'
21052 #include <boost/test/unit_test.hpp>
21053 #include <boost/foreach.hpp>
21054
21055 #include "../checkpoints.h"
21056 #include "../util.h"
21057
21058 using namespace std;
21059
21060 BOOST_AUTO_TEST_SUITE(Checkpoints_tests)
21061
21062 BOOST_AUTO_TEST_CASE(sanity)
21063 {
21064 uint256 p11111 = uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d");
21065 uint256 p140700 = uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd");
21066 BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111));
21067 BOOST_CHECK(Checkpoints::CheckBlock(140700, p140700));
21068
21069
21070 // Wrong hashes at checkpoints should fail:
21071 BOOST_CHECK(!Checkpoints::CheckBlock(11111, p140700));
21072 BOOST_CHECK(!Checkpoints::CheckBlock(140700, p11111));
21073
21074 // ... but any hash not at a checkpoint should succeed:
21075 BOOST_CHECK(Checkpoints::CheckBlock(11111+1, p140700));
21076 BOOST_CHECK(Checkpoints::CheckBlock(140700+1, p11111));
21077
21078 BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 140700);
21079 }
21080
21081 BOOST_AUTO_TEST_SUITE_END()