From 3fffb0cab90a5db135400c9ff63e0d1075a50dca Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 27 Aug 2024 02:04:53 +0700 Subject: [PATCH] refactor: moves evo-deterministicmns_tests specific code from header --- src/test/evo_deterministicmns_tests.cpp | 32 +++++++++++++++++++++++++ src/test/util/setup_common.cpp | 13 ---------- src/test/util/setup_common.h | 20 ---------------- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/test/evo_deterministicmns_tests.cpp b/src/test/evo_deterministicmns_tests.cpp index caedcca2d9..9aed314cbf 100644 --- a/src/test/evo_deterministicmns_tests.cpp +++ b/src/test/evo_deterministicmns_tests.cpp @@ -814,6 +814,38 @@ void FuncVerifyDB(TestChainSetup& setup) BOOST_AUTO_TEST_SUITE(evo_dip3_activation_tests) +struct TestChainDIP3Setup : public TestChainSetup +{ + TestChainDIP3Setup() : TestChainSetup(431) {} +}; + +struct TestChainDIP3BeforeActivationSetup : public TestChainSetup +{ + TestChainDIP3BeforeActivationSetup() : TestChainSetup(430) {} +}; + +struct TestChainV19BeforeActivationSetup : public TestChainSetup +{ + TestChainV19BeforeActivationSetup(); +}; + +struct TestChainV19Setup : public TestChainSetup +{ + TestChainV19Setup() : TestChainSetup(899) + { + bool v19_just_activated{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19) && + !DeploymentActiveAt(*m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)}; + assert(v19_just_activated); + } +}; + +// 5 blocks earlier +TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() : TestChainSetup(894) +{ + bool v19_active{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)}; + assert(!v19_active); +} + // DIP3 can only be activated with legacy scheme (v19 is activated later) BOOST_AUTO_TEST_CASE(dip3_activation_legacy) { diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index e3453a9a6e..7356641e53 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -571,16 +571,3 @@ CBlock getBlock13b8a() return block; } -TestChainV19Setup::TestChainV19Setup() : TestChainSetup(899) -{ - bool v19_just_activated{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19) && - !DeploymentActiveAt(*m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)}; - assert(v19_just_activated); -} - -// 5 blocks earlier -TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() : TestChainSetup(894) -{ - bool v19_active{DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)}; - assert(!v19_active); -} diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 25884a9cf0..f21205cff2 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -183,26 +183,6 @@ struct TestChain100Setup : public TestChainSetup { TestChain100Setup(const std::vector& extra_args = {}); }; -struct TestChainDIP3Setup : public TestChainSetup -{ - TestChainDIP3Setup() : TestChainSetup(431) {} -}; - -struct TestChainV19Setup : public TestChainSetup -{ - TestChainV19Setup(); -}; - -struct TestChainDIP3BeforeActivationSetup : public TestChainSetup -{ - TestChainDIP3BeforeActivationSetup() : TestChainSetup(430) {} -}; - -struct TestChainV19BeforeActivationSetup : public TestChainSetup -{ - TestChainV19BeforeActivationSetup(); -}; - /** * Make a test setup that has disk access to the debug.log file disabled. Can * be used in "hot loops", for example fuzzing or benchmarking.