MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / Block

Function Block

src/test/validation_block_tests.cpp:49–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47};
48
49std::shared_ptr<CBlock> Block(const uint256& prev_hash)
50{
51 static int i = 0;
52 static uint64_t time = Params().GenesisBlock().nTime;
53
54 CScript pubKey;
55 pubKey << i++ << OP_TRUE;
56
57 auto ptemplate = BlockAssembler(Params()).CreateNewBlock(pubKey, false);
58 auto pblock = std::make_shared<CBlock>(ptemplate->block);
59 pblock->hashPrevBlock = prev_hash;
60 pblock->nTime = ++time;
61
62 CMutableTransaction txCoinbase(*pblock->vtx[0]);
63 txCoinbase.vout.resize(1);
64 txCoinbase.vin[0].scriptWitness.SetNull();
65 pblock->vtx[0] = MakeTransactionRef(std::move(txCoinbase));
66
67 return pblock;
68}
69
70std::shared_ptr<CBlock> FinalizeBlock(std::shared_ptr<CBlock> pblock)
71{

Callers 2

GoodBlockFunction · 0.70
BadBlockFunction · 0.70

Calls 6

BlockAssemblerClass · 0.85
MakeTransactionRefFunction · 0.85
CreateNewBlockMethod · 0.80
ParamsClass · 0.50
resizeMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected