Line data Source code
1 : // Copyright (c) 2011-2013 The Bitcoin Core developers 2 : // Copyright (c) 2017-2020 The PIVX Core developers 3 : // Distributed under the MIT/X11 software license, see the accompanying 4 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 : 6 : // 7 : // Unit tests for block-chain checkpoints 8 : // 9 : 10 : #include "checkpoints.h" 11 : 12 : #include "uint256.h" 13 : #include "test_pivx.h" 14 : 15 : #include <boost/test/unit_test.hpp> 16 : 17 : 18 : BOOST_FIXTURE_TEST_SUITE(Checkpoints_tests, BasicTestingSetup) 19 : 20 2 : BOOST_AUTO_TEST_CASE(sanity) 21 : { 22 1 : uint256 p259201 = uint256S("0x1c9121bf9329a6234bfd1ea2d91515f19cd96990725265253f4b164283ade5dd"); 23 1 : uint256 p623933 = uint256S("0xc7aafa648a0f1450157dc93bd4d7448913a85b7448f803b4ab970d91fc2a7da7"); 24 2 : BOOST_CHECK(Checkpoints::CheckBlock(259201, p259201)); 25 2 : BOOST_CHECK(Checkpoints::CheckBlock(623933, p623933)); 26 : 27 : 28 : // Wrong hashes at checkpoints should fail: 29 2 : BOOST_CHECK(!Checkpoints::CheckBlock(259201, p623933)); 30 2 : BOOST_CHECK(!Checkpoints::CheckBlock(623933, p259201)); 31 : 32 : // ... but any hash not at a checkpoint should succeed: 33 2 : BOOST_CHECK(Checkpoints::CheckBlock(259201+1, p623933)); 34 2 : BOOST_CHECK(Checkpoints::CheckBlock(623933+1, p259201)); 35 : 36 2 : BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 623933); 37 1 : } 38 : 39 : BOOST_AUTO_TEST_SUITE_END()