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

Function PrepareBlock

src/test/util/mining.cpp:77–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
78{
79 auto block = std::make_shared<CBlock>(
80 BlockAssembler{Assert(node.chainman)->ActiveChainstate(), *Assert(node.mempool), Params()}
81 .CreateNewBlock(coinbase_scriptPubKey)
82 ->block);
83
84 LOCK(cs_main);
85 block->nTime = Assert(node.chainman)->ActiveChain().Tip()->GetMedianTimePast() + 1;
86 block->hashMerkleRoot = BlockMerkleRoot(*block);
87
88 return block;
89}

Callers 2

MineBlockFunction · 0.85
AssembleBlockFunction · 0.85

Calls 5

BlockMerkleRootFunction · 0.85
CreateNewBlockMethod · 0.80
GetMedianTimePastMethod · 0.80
ParamsClass · 0.50
TipMethod · 0.45

Tested by

no test coverage detected