Skip to content

Commit 63d640f

Browse files
committed
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`.
1 parent be27055 commit 63d640f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/consensus/merkle.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,14 @@ uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated)
8484
return ComputeMerkleRoot(std::move(leaves), mutated);
8585
}
8686

87-
/* This implements a constant-space merkle root/path calculator, limited to 2^32 leaves. */
88-
static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot, bool* pmutated, uint32_t leaf_pos, std::vector<uint256>& path)
87+
/* This implements a constant-space merkle path calculator, limited to 2^32 leaves. */
88+
static void MerkleComputation(const std::vector<uint256>& leaves, uint32_t leaf_pos, std::vector<uint256>& path)
8989
{
9090
path.clear();
9191
Assume(leaves.size() <= UINT32_MAX);
9292
if (leaves.size() == 0) {
93-
if (pmutated) *pmutated = false;
94-
if (proot) *proot = uint256();
9593
return;
9694
}
97-
bool mutated = false;
9895
// count is the number of leaves processed so far.
9996
uint32_t count = 0;
10097
// 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
121118
path.push_back(h);
122119
matchh = true;
123120
}
124-
mutated |= (inner[level] == h);
125121
h = Hash(inner[level], h);
126122
}
127123
// Store the resulting hash at inner position level.
@@ -165,14 +161,11 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
165161
level++;
166162
}
167163
}
168-
// Return result.
169-
if (pmutated) *pmutated = mutated;
170-
if (proot) *proot = h;
171164
}
172165

173166
static std::vector<uint256> ComputeMerklePath(const std::vector<uint256>& leaves, uint32_t position) {
174167
std::vector<uint256> ret;
175-
MerkleComputation(leaves, nullptr, nullptr, position, ret);
168+
MerkleComputation(leaves, position, ret);
176169
return ret;
177170
}
178171

0 commit comments

Comments
 (0)