fixed tests not allowing nAllClaimsInMerkleForkHight < 140

This commit is contained in:
Brannon King 2019-12-20 14:08:10 -07:00
parent 5bfee60297
commit e53590bb8c
2 changed files with 11 additions and 3 deletions

View file

@ -200,10 +200,13 @@ bool ClaimTrieChainFixture::CreateCoinbases(unsigned int num_coinbases, std::vec
{ {
std::unique_ptr<CBlockTemplate> pblocktemplate; std::unique_ptr<CBlockTemplate> pblocktemplate;
coinbases.clear(); coinbases.clear();
BOOST_CHECK(pblocktemplate = AssemblerForTest().CreateNewBlock(CScript() << OP_TRUE)); BOOST_REQUIRE(pblocktemplate = AssemblerForTest().CreateNewBlock(CScript() << OP_TRUE));
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 1); BOOST_REQUIRE_EQUAL(pblocktemplate->block.vtx.size(), 1);
for (unsigned int i = 0; i < 100 + num_coinbases; ++i) { 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) if (coinbases.size() < num_coinbases)
coinbases.push_back(std::move(*pblocktemplate->block.vtx[0])); coinbases.push_back(std::move(*pblocktemplate->block.vtx[0]));
} }

View file

@ -6,6 +6,7 @@
#include <chainparams.h> #include <chainparams.h>
#include <claimtrie/forks.h> #include <claimtrie/forks.h>
#include <claimtrie/hashes.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <consensus/validation.h> #include <consensus/validation.h>
#include <crypto/sha256.h> #include <crypto/sha256.h>
@ -122,6 +123,10 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
RegisterAllCoreRPCCommands(tableRPC); RegisterAllCoreRPCCommands(tableRPC);
ClearDatadirCache(); ClearDatadirCache();
sha256n_way = [](std::vector<uint256>& hashes) {
SHA256D64(hashes[0].begin(), hashes[0].begin(), hashes.size() / 2);
};
// We have to run a scheduler thread to prevent ActivateBestChain // We have to run a scheduler thread to prevent ActivateBestChain
// from blocking due to queue overrun. // from blocking due to queue overrun.
threadGroup.create_thread(boost::bind(&CScheduler::serviceQueue, &scheduler)); threadGroup.create_thread(boost::bind(&CScheduler::serviceQueue, &scheduler));