2020-12-31 18:50:11 +01:00
|
|
|
// Copyright (c) 2014-2020 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2014-03-18 10:11:00 +01:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <net.h>
|
2023-06-01 16:57:52 +02:00
|
|
|
#include <uint256.h>
|
|
|
|
#include <validation.h>
|
2014-02-19 01:54:11 +01:00
|
|
|
|
2022-02-25 18:19:25 +01:00
|
|
|
#include <test/util/setup_common.h>
|
2015-03-09 15:04:12 +01:00
|
|
|
|
2014-02-19 01:54:11 +01:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
|
2021-08-11 06:18:40 +02:00
|
|
|
BOOST_FIXTURE_TEST_SUITE(validation_tests, TestingSetup)
|
2014-02-19 01:54:11 +01:00
|
|
|
|
2023-06-01 16:57:52 +02:00
|
|
|
//! Test retrieval of valid assumeutxo values.
|
|
|
|
BOOST_AUTO_TEST_CASE(test_assumeutxo)
|
|
|
|
{
|
2020-09-30 16:18:57 +02:00
|
|
|
const auto params = CreateChainParams(*m_node.args, CBaseChainParams::REGTEST);
|
2023-06-01 16:57:52 +02:00
|
|
|
|
|
|
|
// These heights don't have assumeutxo configurations associated, per the contents
|
|
|
|
// of chainparams.cpp.
|
|
|
|
std::vector<int> bad_heights{0, 100, 111, 115, 209, 211};
|
|
|
|
|
|
|
|
for (auto empty : bad_heights) {
|
|
|
|
const auto out = ExpectedAssumeutxo(empty, *params);
|
|
|
|
BOOST_CHECK(!out);
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto out110 = *ExpectedAssumeutxo(110, *params);
|
2023-04-26 08:28:10 +02:00
|
|
|
BOOST_CHECK_EQUAL(out110.hash_serialized.ToString(), "9b2a277a3e3b979f1a539d57e949495d7f8247312dbc32bce6619128c192b44b");
|
2024-07-21 16:20:05 +02:00
|
|
|
BOOST_CHECK_EQUAL(out110.nChainTx, 110U);
|
2023-06-01 16:57:52 +02:00
|
|
|
|
2024-07-21 16:20:05 +02:00
|
|
|
const auto out210 = *ExpectedAssumeutxo(200, *params);
|
|
|
|
BOOST_CHECK_EQUAL(out210.hash_serialized.ToString(), "8a5bdd92252fc6b24663244bbe958c947bb036dc1f94ccd15439f48d8d1cb4e3");
|
|
|
|
BOOST_CHECK_EQUAL(out210.nChainTx, 200U);
|
2023-06-01 16:57:52 +02:00
|
|
|
}
|
|
|
|
|
2014-02-19 01:54:11 +01:00
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|