From 0497e06143ed9aac2e29c4c6ae39102f7bf9fda4 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/setup_common.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/setup_common.cpp b/src/test/setup_common.cpp index f9a52f29b..82ba79c26 100644 --- a/src/test/setup_common.cpp +++ b/src/test/setup_common.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,10 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha try { RegisterAllCoreRPCCommands(tableRPC); + 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(std::bind(&CScheduler::serviceQueue, &scheduler));