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

Function RegenerateCommitments

src/node/miner.cpp:59–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void RegenerateCommitments(CBlock& block, ChainstateManager& chainman)
60{
61 CMutableTransaction tx{*block.vtx.at(0)};
62 tx.vout.erase(tx.vout.begin() + GetWitnessCommitmentIndex(block));
63 tx.witness.vtxoutwit.erase(tx.witness.vtxoutwit.begin() + GetWitnessCommitmentIndex(block));
64 block.vtx.at(0) = MakeTransactionRef(tx);
65
66 CBlockIndex* prev_block = WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock));
67 GenerateCoinbaseCommitment(block, prev_block, Params().GetConsensus());
68
69 block.hashMerkleRoot = BlockMerkleRoot(block);
70}
71
72BlockAssembler::Options::Options()
73{

Callers 2

CreateBlockMethod · 0.85
generateblockFunction · 0.85

Calls 8

BlockMerkleRootFunction · 0.85
LookupBlockIndexMethod · 0.80
ParamsClass · 0.70
MakeTransactionRefFunction · 0.50
eraseMethod · 0.45
beginMethod · 0.45

Tested by 1

CreateBlockMethod · 0.68