MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / PrepareBlock

Function PrepareBlock

src/test/util/mining.cpp:131–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node,
132 const node::BlockCreateOptions& assembler_options)
133{
134 auto mining = interfaces::MakeMining(node);
135 auto block_template = mining->createNewBlock(assembler_options, /*cooldown=*/false);
136 auto block = std::make_shared<CBlock>(Assert(block_template)->getBlock());
137
138 LOCK(cs_main);
139 block->nTime = Assert(node.chainman)->ActiveChain().Tip()->GetMedianTimePast() + 1;
140 block->hashMerkleRoot = BlockMerkleRoot(*block);
141
142 return block;
143}

Callers 4

FUZZ_TARGETFunction · 0.85
MineBlockFunction · 0.85
AssembleBlockFunction · 0.85

Calls 6

MakeMiningFunction · 0.85
BlockMerkleRootFunction · 0.85
createNewBlockMethod · 0.80
getBlockMethod · 0.80
GetMedianTimePastMethod · 0.80
TipMethod · 0.45

Tested by

no test coverage detected