MCPcopy Create free account
hub / github.com/ElementsProject/elements / CreateBlock

Method CreateBlock

src/test/util/setup_common.cpp:295–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295CBlock TestChain100Setup::CreateBlock(
296 const std::vector<CMutableTransaction>& txns,
297 const CScript& scriptPubKey,
298 CChainState& chainstate)
299{
300 const CChainParams& chainparams = Params();
301 CTxMemPool empty_pool;
302 CBlock block = BlockAssembler(chainstate, empty_pool, chainparams).CreateNewBlock(scriptPubKey)->block;
303
304 Assert(block.vtx.size() == 1);
305 for (const CMutableTransaction& tx : txns) {
306 block.vtx.push_back(MakeTransactionRef(tx));
307 }
308 RegenerateCommitments(block, *Assert(m_node.chainman));
309
310 while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;
311
312 return block;
313}
314
315CBlock TestChain100Setup::CreateAndProcessBlock(
316 const std::vector<CMutableTransaction>& txns,

Callers 2

CreateAndProcessBlockMethod · 0.95
BOOST_FIXTURE_TEST_CASEFunction · 0.45

Calls 9

BlockAssemblerClass · 0.85
RegenerateCommitmentsFunction · 0.85
CheckProofOfWorkFunction · 0.85
CreateNewBlockMethod · 0.80
ParamsClass · 0.50
MakeTransactionRefFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected