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

Function BlockWitnessMerkleRoot

src/consensus/merkle.cpp:75–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated)
76{
77 std::vector<uint256> leaves;
78 leaves.resize(block.vtx.size());
79 if (g_con_elementsmode) {
80 // Coinbase witness hash for inputs is just CTxInWitness().GetHash()
81 for (size_t s = 0; s < block.vtx.size(); s++) {
82 leaves[s] = block.vtx[s]->GetWitnessOnlyHash();
83 }
84 return ComputeFastMerkleRoot(std::move(leaves));
85 } else {
86 leaves[0].SetNull(); // The witness hash of the coinbase is 0.
87 for (size_t s = 1; s < block.vtx.size(); s++) {
88 leaves[s] = block.vtx[s]->GetWitnessHash();
89 }
90 return ComputeMerkleRoot(std::move(leaves), mutated);
91 }
92}

Callers 4

ContextualCheckBlockFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85

Calls 6

ComputeFastMerkleRootFunction · 0.85
ComputeMerkleRootFunction · 0.85
GetWitnessOnlyHashMethod · 0.80
resizeMethod · 0.45
sizeMethod · 0.45
SetNullMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68