aboutsummaryrefslogtreecommitdiff
path: root/src/test/validation_tests.cpp
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2019-04-25 11:09:29 -0400
committerJames O'Beirne <james.obeirne@pm.me>2021-02-12 07:53:22 -0600
commit7a6c46b37edb8bfa0085d202aa7e9427d5e4fceb (patch)
tree68f691ce5fec4b11dc22465db1ac82b25662f128 /src/test/validation_tests.cpp
parente9c037ba64dd5b073fccf059ef75db1c97abd0bd (diff)
downloadbitcoin-7a6c46b37edb8bfa0085d202aa7e9427d5e4fceb.tar.xz
chainparams: add allowed assumeutxo values
Values for mainnet and testnet will be specified in a follow-up PR that can be scrutinized accordingly. This structure is required for use in snapshot activation logic.
Diffstat (limited to 'src/test/validation_tests.cpp')
-rw-r--r--src/test/validation_tests.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp
index 9e37f14921..ecf9453094 100644
--- a/src/test/validation_tests.cpp
+++ b/src/test/validation_tests.cpp
@@ -5,6 +5,7 @@
#include <chainparams.h>
#include <net.h>
#include <signet.h>
+#include <uint256.h>
#include <validation.h>
#include <test/util/setup_common.h>
@@ -119,4 +120,27 @@ BOOST_AUTO_TEST_CASE(signet_parse_tests)
BOOST_CHECK(!CheckSignetBlockSolution(block, signet_params->GetConsensus()));
}
+//! Test retrieval of valid assumeutxo values.
+BOOST_AUTO_TEST_CASE(test_assumeutxo)
+{
+ const auto params = CreateChainParams(*m_node.args, CBaseChainParams::REGTEST);
+
+ // 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);
+ BOOST_CHECK_EQUAL(out110.hash_serialized, uint256S("76fd7334ac7c1baf57ddc0c626f073a655a35d98a4258cd1382c8cc2b8392e10"));
+ BOOST_CHECK_EQUAL(out110.nChainTx, (unsigned int)110);
+
+ const auto out210 = *ExpectedAssumeutxo(210, *params);
+ BOOST_CHECK_EQUAL(out210.hash_serialized, uint256S("9c5ed99ef98544b34f8920b6d1802f72ac28ae6e2bd2bd4c316ff10c230df3f2"));
+ BOOST_CHECK_EQUAL(out210.nChainTx, (unsigned int)210);
+}
+
BOOST_AUTO_TEST_SUITE_END()