merkle: remove unused proot and pmutated args from MerkleComputation

There's a single call to the methods from `ComputeMerklePath` where these were always set to `nullptr`.
This commit is contained in:
Lőrinc
2025-11-05 21:00:24 +01:00
parent be270551df
commit 63d640fa6a

View File

@@ -84,17 +84,14 @@ uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated)
return ComputeMerkleRoot(std::move(leaves), mutated);
}
/* This implements a constant-space merkle root/path calculator, limited to 2^32 leaves. */
static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot, bool* pmutated, uint32_t leaf_pos, std::vector<uint256>& path)
/* This implements a constant-space merkle path calculator, limited to 2^32 leaves. */
static void MerkleComputation(const std::vector<uint256>& leaves, uint32_t leaf_pos, std::vector<uint256>& path)
{
path.clear();
Assume(leaves.size() <= UINT32_MAX);
if (leaves.size() == 0) {
if (pmutated) *pmutated = false;
if (proot) *proot = uint256();
return;
}
bool mutated = false;
// count is the number of leaves processed so far.
uint32_t count = 0;
// inner is an array of eagerly computed subtree hashes, indexed by tree
@@ -121,7 +118,6 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
path.push_back(h);
matchh = true;
}
mutated |= (inner[level] == h);
h = Hash(inner[level], h);
}
// Store the resulting hash at inner position level.
@@ -165,14 +161,11 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
level++;
}
}
// Return result.
if (pmutated) *pmutated = mutated;
if (proot) *proot = h;
}
static std::vector<uint256> ComputeMerklePath(const std::vector<uint256>& leaves, uint32_t position) {
std::vector<uint256> ret;
MerkleComputation(leaves, nullptr, nullptr, position, ret);
MerkleComputation(leaves, position, ret);
return ret;
}