miner: Pass in previous CBlockIndex to RegenerateCommitments

This commit is contained in:
Carl Dong
2021-04-05 11:11:22 -04:00
parent 66daf4cb3b
commit cced0f46c9
4 changed files with 8 additions and 6 deletions

View File

@@ -253,7 +253,8 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
for (const CMutableTransaction& tx : txns) {
block.vtx.push_back(MakeTransactionRef(tx));
}
RegenerateCommitments(block, WITH_LOCK(::cs_main, return std::ref(g_chainman.m_blockman)));
CBlockIndex* prev_block = WITH_LOCK(::cs_main, return g_chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock));
RegenerateCommitments(block, prev_block);
while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;