Line data Source code
1 : // Copyright (c) 2014-2021 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #include <consensus/amount.h> 6 : #include <net.h> 7 : #include <uint256.h> 8 : #include <validation.h> 9 : 10 : #include <test/util/setup_common.h> 11 : 12 : #include <boost/test/unit_test.hpp> 13 : 14 146 : BOOST_FIXTURE_TEST_SUITE(validation_tests, TestingSetup) 15 : 16 : //! Test retrieval of valid assumeutxo values. 17 149 : BOOST_AUTO_TEST_CASE(test_assumeutxo) 18 : { 19 1 : const auto params = CreateChainParams(*m_node.args, CBaseChainParams::REGTEST); 20 : 21 : // These heights don't have assumeutxo configurations associated, per the contents 22 : // of chainparams.cpp. 23 1 : std::vector<int> bad_heights{0, 100, 111, 115, 209, 211}; 24 : 25 7 : for (auto empty : bad_heights) { 26 6 : const auto out = ExpectedAssumeutxo(empty, *params); 27 6 : BOOST_CHECK(!out); 28 : } 29 : 30 1 : const auto out110 = *ExpectedAssumeutxo(110, *params); 31 1 : BOOST_CHECK_EQUAL(out110.hash_serialized.ToString(), "9b2a277a3e3b979f1a539d57e949495d7f8247312dbc32bce6619128c192b44b"); 32 1 : BOOST_CHECK_EQUAL(out110.nChainTx, 110U); 33 : 34 1 : const auto out210 = *ExpectedAssumeutxo(200, *params); 35 1 : BOOST_CHECK_EQUAL(out210.hash_serialized.ToString(), "8a5bdd92252fc6b24663244bbe958c947bb036dc1f94ccd15439f48d8d1cb4e3"); 36 1 : BOOST_CHECK_EQUAL(out210.nChainTx, 200U); 37 1 : } 38 : 39 146 : BOOST_AUTO_TEST_SUITE_END()