aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/merkle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus/merkle.cpp')
-rw-r--r--src/consensus/merkle.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/consensus/merkle.cpp b/src/consensus/merkle.cpp
index 22eb7159a2..35f7d2e05a 100644
--- a/src/consensus/merkle.cpp
+++ b/src/consensus/merkle.cpp
@@ -165,6 +165,17 @@ uint256 BlockMerkleRoot(const CBlock& block, bool* mutated)
return ComputeMerkleRoot(leaves, mutated);
}
+uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated)
+{
+ std::vector<uint256> leaves;
+ leaves.resize(block.vtx.size());
+ leaves[0].SetNull(); // The witness hash of the coinbase is 0.
+ for (size_t s = 1; s < block.vtx.size(); s++) {
+ leaves[s] = block.vtx[s].GetWitnessHash();
+ }
+ return ComputeMerkleRoot(leaves, mutated);
+}
+
std::vector<uint256> BlockMerkleBranch(const CBlock& block, uint32_t position)
{
std::vector<uint256> leaves;