| 442 | } |
| 443 | |
| 444 | CBlock TestChain100Setup::CreateBlock( |
| 445 | const std::vector<CMutableTransaction>& txns, |
| 446 | const CScript& scriptPubKey) |
| 447 | { |
| 448 | auto mining{interfaces::MakeMining(m_node)}; |
| 449 | auto block_template{mining->createNewBlock({ |
| 450 | .use_mempool = false, |
| 451 | .coinbase_output_script = scriptPubKey, |
| 452 | }, /*cooldown=*/false)}; |
| 453 | Assert(block_template); |
| 454 | CBlock block{block_template->getBlock()}; |
| 455 | |
| 456 | Assert(block.vtx.size() == 1); |
| 457 | for (const CMutableTransaction& tx : txns) { |
| 458 | block.vtx.push_back(MakeTransactionRef(tx)); |
| 459 | } |
| 460 | RegenerateCommitments(block, *Assert(m_node.chainman)); |
| 461 | |
| 462 | while (!CheckProofOfWork(block.GetHash(), block.nBits, m_node.chainman->GetConsensus())) ++block.nNonce; |
| 463 | |
| 464 | return block; |
| 465 | } |
| 466 | |
| 467 | CBlock TestChain100Setup::CreateAndProcessBlock( |
| 468 | const std::vector<CMutableTransaction>& txns, |
no test coverage detected