diff --git a/src/chainparams.cpp b/src/chainparams.cpp index fff75b8d9e..ca23c2144e 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -537,7 +537,7 @@ public: m_assumeutxo_data = MapAssumeutxo{ { 110, - {uint256S("0x4fa9f2be16670cb097173e6b788974fb9106c2335c074267ca5f7fc297dded32"), 110}, + {uint256S("0x09a3e443dbf48f3b95207c9ce529062d9764395232c482aa7d3a0bf274d282d9"), 110}, }, { 210, diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 745e21f88f..506fc3c678 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -227,43 +227,31 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::string& fedp } } -TestChain100Setup::TestChain100Setup(bool deterministic) +TestChain100Setup::TestChain100Setup() { - m_deterministic = deterministic; - - if (m_deterministic) { - SetMockTime(1598887952); - constexpr std::array vchKey = { - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 - } - }; - coinbaseKey.Set(vchKey.begin(), vchKey.end(), false); - } else { - coinbaseKey.MakeNewKey(true); - } + SetMockTime(1598887952); + constexpr std::array vchKey = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}; + coinbaseKey.Set(vchKey.begin(), vchKey.end(), true); // Generate a 100-block chain: this->mineBlocks(COINBASE_MATURITY); - if (m_deterministic) { + { LOCK(::cs_main); assert( m_node.chainman->ActiveChain().Tip()->GetBlockHash().ToString() == - "49c95db1e470fed04496d801c9d8fbb78155d2c7f855232c918823d2c17d0cf6"); + "571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191"); } } void TestChain100Setup::mineBlocks(int num_blocks) { CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; - for (int i = 0; i < num_blocks; i++) - { + for (int i = 0; i < num_blocks; i++) { std::vector noTxns; CBlock b = CreateAndProcessBlock(noTxns, scriptPubKey); - if (m_deterministic) { - SetMockTime(GetTime() + 1); - } + SetMockTime(GetTime() + 1); m_coinbase_txns.push_back(b.vtx[0]); } } @@ -340,9 +328,7 @@ CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction(CTransactio TestChain100Setup::~TestChain100Setup() { gArgs.ForceSetArg("-segwitheight", "0"); - if (m_deterministic) { - SetMockTime(0); - } + SetMockTime(0); } CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) const diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index e4cba91f32..f0c5b4ff1e 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -112,7 +112,7 @@ class CScript; * Testing fixture that pre-creates a 100-block REGTEST-mode block chain */ struct TestChain100Setup : public RegTestingSetup { - TestChain100Setup(bool deterministic = false); + TestChain100Setup(); /** * Create a new block with just given transactions, coinbase paying to @@ -143,16 +143,10 @@ struct TestChain100Setup : public RegTestingSetup { ~TestChain100Setup(); - bool m_deterministic; std::vector m_coinbase_txns; // For convenience, coinbase transactions CKey coinbaseKey; // private/public key needed to spend coinbase transactions }; - -struct TestChain100DeterministicSetup : public TestChain100Setup { - TestChain100DeterministicSetup() : TestChain100Setup(true) { } -}; - /** * 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. diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp index 35e087c899..ab31662f97 100644 --- a/src/test/validation_chainstatemanager_tests.cpp +++ b/src/test/validation_chainstatemanager_tests.cpp @@ -200,7 +200,7 @@ CreateAndActivateUTXOSnapshot(NodeContext& node, const fs::path root, F malleati } //! Test basic snapshot activation. -BOOST_FIXTURE_TEST_CASE(chainstatemanager_activate_snapshot, TestChain100DeterministicSetup) +BOOST_FIXTURE_TEST_CASE(chainstatemanager_activate_snapshot, TestChain100Setup) { ChainstateManager& chainman = *Assert(m_node.chainman); diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp index cb783682d4..92503c035c 100644 --- a/src/test/validation_tests.cpp +++ b/src/test/validation_tests.cpp @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(test_assumeutxo) } const auto out110 = *ExpectedAssumeutxo(110, *params); - BOOST_CHECK_EQUAL(out110.hash_serialized, uint256S("4fa9f2be16670cb097173e6b788974fb9106c2335c074267ca5f7fc297dded32")); + BOOST_CHECK_EQUAL(out110.hash_serialized, uint256S("09a3e443dbf48f3b95207c9ce529062d9764395232c482aa7d3a0bf274d282d9")); BOOST_CHECK_EQUAL(out110.nChainTx, (unsigned int)110); const auto out210 = *ExpectedAssumeutxo(210, *params);