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

Function AddMerkleRootAndCoinbase

src/node/miner.cpp:347–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345}
346
347void AddMerkleRootAndCoinbase(CBlock& block, CTransactionRef coinbase, uint32_t version, uint32_t timestamp, uint32_t nonce)
348{
349 if (block.vtx.size() == 0) {
350 block.vtx.emplace_back(coinbase);
351 } else {
352 block.vtx[0] = coinbase;
353 }
354 block.nVersion = version;
355 block.nTime = timestamp;
356 block.nNonce = nonce;
357 block.hashMerkleRoot = BlockMerkleRoot(block);
358
359 // Reset cached checks
360 block.m_checked_witness_commitment = false;
361 block.m_checked_merkle_root = false;
362 block.fChecked = false;
363}
364
365namespace {
366class SubmitBlockStateCatcher final : public CValidationInterface

Callers 1

submitSolutionMethod · 0.85

Calls 3

BlockMerkleRootFunction · 0.85
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected