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

Function UpdateUncommittedBlockStructures

src/validation.cpp:3644–3655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3642}
3643
3644void UpdateUncommittedBlockStructures(CBlock& block, const CBlockIndex* pindexPrev, const Consensus::Params& consensusParams)
3645{
3646 int commitpos = GetWitnessCommitmentIndex(block);
3647 static const std::vector<unsigned char> nonce(32, 0x00);
3648 if (commitpos != NO_WITNESS_COMMITMENT && DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_SEGWIT) && !block.vtx[0]->HasWitness()) {
3649 CMutableTransaction tx(*block.vtx[0]);
3650 tx.witness.vtxinwit.resize(1);
3651 tx.witness.vtxinwit[0].scriptWitness.stack.resize(1);
3652 tx.witness.vtxinwit[0].scriptWitness.stack[0] = nonce;
3653 block.vtx[0] = MakeTransactionRef(std::move(tx));
3654 }
3655}
3656
3657std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBlockIndex* pindexPrev, const Consensus::Params& consensusParams)
3658{

Callers 2

submitblockFunction · 0.85

Calls 5

DeploymentActiveAfterFunction · 0.85
MakeTransactionRefFunction · 0.50
HasWitnessMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected