fixed tests not allowing nAllClaimsInMerkleForkHight < 140

This commit is contained in:
Brannon King 2019-12-20 14:08:10 -07:00 committed by Anthony Fieroni
parent e904a9fce6
commit 0497e06143
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

@ -7,6 +7,7 @@
#include <banman.h> #include <banman.h>
#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/params.h> #include <consensus/params.h>
#include <consensus/validation.h> #include <consensus/validation.h>
@ -116,6 +117,10 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
try { try {
RegisterAllCoreRPCCommands(tableRPC); RegisterAllCoreRPCCommands(tableRPC);
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(std::bind(&CScheduler::serviceQueue, &scheduler)); threadGroup.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));