Fix CreateNewBlock_validity by not holding cs_main when calling createAndProcessEmptyBlock

This commit is contained in:
Alexander Block 2019-03-12 09:33:53 +01:00
parent 95192d5b56
commit 72af215a36

View File

@ -257,6 +257,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
createAndProcessEmptyBlock();
}
{
LOCK(cs_main);
// Just to make sure we can still make simple blocks
@ -507,9 +508,13 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++)
chainActive.Tip()->GetAncestor(chainActive.Tip()->nHeight - i)->nTime += 512; //Trick the MedianTimePast
} // unlock cs_main while calling createAndProcessEmptyBlock
// Mine an empty block
createAndProcessEmptyBlock();
LOCK(cs_main);
SetMockTime(chainActive.Tip()->GetMedianTimePast() + 1);
BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));