mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-13 00:56:57 +02:00
[validation] Always include merkle root in coinbase commitment
This commit is contained in:
@ -3094,7 +3094,6 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
|
|||||||
std::vector<unsigned char> commitment;
|
std::vector<unsigned char> commitment;
|
||||||
int commitpos = GetWitnessCommitmentIndex(block);
|
int commitpos = GetWitnessCommitmentIndex(block);
|
||||||
std::vector<unsigned char> ret(32, 0x00);
|
std::vector<unsigned char> ret(32, 0x00);
|
||||||
if (DeploymentEnabled(consensusParams, Consensus::DEPLOYMENT_SEGWIT)) {
|
|
||||||
if (commitpos == NO_WITNESS_COMMITMENT) {
|
if (commitpos == NO_WITNESS_COMMITMENT) {
|
||||||
uint256 witnessroot = BlockWitnessMerkleRoot(block, nullptr);
|
uint256 witnessroot = BlockWitnessMerkleRoot(block, nullptr);
|
||||||
CHash256().Write(witnessroot).Write(ret).Finalize(witnessroot);
|
CHash256().Write(witnessroot).Write(ret).Finalize(witnessroot);
|
||||||
@ -3113,7 +3112,6 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
|
|||||||
tx.vout.push_back(out);
|
tx.vout.push_back(out);
|
||||||
block.vtx[0] = MakeTransactionRef(std::move(tx));
|
block.vtx[0] = MakeTransactionRef(std::move(tx));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
UpdateUncommittedBlockStructures(block, pindexPrev, consensusParams);
|
UpdateUncommittedBlockStructures(block, pindexPrev, consensusParams);
|
||||||
return commitment;
|
return commitment;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user