Skip to content

Commit

Permalink
Fix CreateNewBlock_validity by not holding cs_main when calling creat…
Browse files Browse the repository at this point in the history
…eAndProcessEmptyBlock
  • Loading branch information
codablock committed Mar 12, 2019
1 parent 95192d5 commit 72af215
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/miner_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
createAndProcessEmptyBlock();
}

{
LOCK(cs_main);

// Just to make sure we can still make simple blocks
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 72af215

Please sign in to comment.