Line data Source code
1 : // Copyright (c) 2022-2025 The Dash 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 <test/util/setup_common.h>
6 :
7 : #include <chainparams.h>
8 : #include <llmq/options.h>
9 : #include <validation.h>
10 :
11 : #include <boost/test/unit_test.hpp>
12 :
13 : using node::NodeContext;
14 :
15 : /* TODO: rename this file and test to llmq_options_test */
16 146 : BOOST_AUTO_TEST_SUITE(evo_utils_tests)
17 :
18 2 : void Test(NodeContext& node)
19 : {
20 : using namespace llmq;
21 2 : auto tip = node.chainman->ActiveTip();
22 2 : const auto& consensus_params = Params().GetConsensus();
23 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeDIP0024InstantSend, tip,
24 : /*optDIP0024IsActive=*/false, /*optHaveDIP0024Quorums=*/false),
25 : false);
26 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeDIP0024InstantSend, tip,
27 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/false),
28 : true);
29 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeDIP0024InstantSend, tip,
30 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/true),
31 : true);
32 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeChainLocks, tip,
33 : /*optDIP0024IsActive=*/false, /*optHaveDIP0024Quorums=*/false),
34 : true);
35 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeChainLocks, tip,
36 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/false),
37 : true);
38 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeChainLocks, tip,
39 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/true),
40 : true);
41 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypePlatform, tip,
42 : /*optDIP0024IsActive=*/false, /*optHaveDIP0024Quorums=*/false),
43 : Params().IsTestChain());
44 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypePlatform, tip,
45 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/false),
46 : Params().IsTestChain());
47 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypePlatform, tip,
48 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/true),
49 : Params().IsTestChain());
50 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeMnhf, tip,
51 : /*optDIP0024IsActive=*/false, /*optHaveDIP0024Quorums=*/false),
52 : true);
53 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeMnhf, tip,
54 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/false),
55 : true);
56 2 : BOOST_CHECK_EQUAL(node.chainman->IsQuorumTypeEnabled(consensus_params.llmqTypeMnhf, tip,
57 : /*optDIP0024IsActive=*/true, /*optHaveDIP0024Quorums=*/true),
58 : true);
59 2 : }
60 :
61 149 : BOOST_FIXTURE_TEST_CASE(utils_IsQuorumTypeEnabled_tests_regtest, RegTestingSetup)
62 : {
63 1 : Test(m_node);
64 1 : }
65 :
66 149 : BOOST_FIXTURE_TEST_CASE(utils_IsQuorumTypeEnabled_tests_mainnet, TestingSetup)
67 : {
68 1 : Test(m_node);
69 1 : }
70 :
71 146 : BOOST_AUTO_TEST_SUITE_END()
|