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

Method UpdateUncommittedBlockStructures

src/validation.cpp:3995–4005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3993}
3994
3995void ChainstateManager::UpdateUncommittedBlockStructures(CBlock& block, const CBlockIndex* pindexPrev) const
3996{
3997 int commitpos = GetWitnessCommitmentIndex(block);
3998 static const std::vector<unsigned char> nonce(32, 0x00);
3999 if (commitpos != NO_WITNESS_COMMITMENT && DeploymentActiveAfter(pindexPrev, *this, Consensus::DEPLOYMENT_SEGWIT) && !block.vtx[0]->HasWitness()) {
4000 CMutableTransaction tx(*block.vtx[0]);
4001 tx.vin[0].scriptWitness.stack.resize(1);
4002 tx.vin[0].scriptWitness.stack[0] = nonce;
4003 block.vtx[0] = MakeTransactionRef(std::move(tx));
4004 }
4005}
4006
4007void ChainstateManager::GenerateCoinbaseCommitment(CBlock& block, const CBlockIndex* pindexPrev) const
4008{

Callers 1

submitblockFunction · 0.80

Calls 5

MakeTransactionRefFunction · 0.85
DeploymentActiveAfterFunction · 0.70
HasWitnessMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected