From e53590bb8c6221af28ea1705b111d6aff917116c Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 20 Dec 2019 14:08:10 -0700 Subject: [PATCH] fixed tests not allowing nAllClaimsInMerkleForkHight < 140 --- src/test/claimtriefixture.cpp | 9 ++++++--- src/test/test_bitcoin.cpp | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/claimtriefixture.cpp b/src/test/claimtriefixture.cpp index 411d61658..bc77b4b67 100644 --- a/src/test/claimtriefixture.cpp +++ b/src/test/claimtriefixture.cpp @@ -200,10 +200,13 @@ bool ClaimTrieChainFixture::CreateCoinbases(unsigned int num_coinbases, std::vec { std::unique_ptr pblocktemplate; coinbases.clear(); - BOOST_CHECK(pblocktemplate = AssemblerForTest().CreateNewBlock(CScript() << OP_TRUE)); - BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 1); + BOOST_REQUIRE(pblocktemplate = AssemblerForTest().CreateNewBlock(CScript() << OP_TRUE)); + BOOST_REQUIRE_EQUAL(pblocktemplate->block.vtx.size(), 1); for (unsigned int i = 0; i < 100 + num_coinbases; ++i) { - BOOST_CHECK(CreateBlock(pblocktemplate)); + if (!CreateBlock(pblocktemplate)) { + BOOST_REQUIRE(pblocktemplate = AssemblerForTest().CreateNewBlock(CScript() << OP_TRUE)); + BOOST_REQUIRE(CreateBlock(pblocktemplate)); + } if (coinbases.size() < num_coinbases) coinbases.push_back(std::move(*pblocktemplate->block.vtx[0])); } diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index a72ea29ea..40f1cb492 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -122,6 +123,10 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha RegisterAllCoreRPCCommands(tableRPC); ClearDatadirCache(); + sha256n_way = [](std::vector& hashes) { + SHA256D64(hashes[0].begin(), hashes[0].begin(), hashes.size() / 2); + }; + // We have to run a scheduler thread to prevent ActivateBestChain // from blocking due to queue overrun. threadGroup.create_thread(boost::bind(&CScheduler::serviceQueue, &scheduler));