diff --git a/src/crypto/equihash.cpp b/src/crypto/equihash.cpp index 31cb4319f..d2686a263 100644 --- a/src/crypto/equihash.cpp +++ b/src/crypto/equihash.cpp @@ -303,9 +303,10 @@ bool Equihash::BasicSolve(const eh_HashState& base_state, return false; } +template bool IsProbablyDuplicate(std::shared_ptr indices, size_t lenIndices) { - bool checked_index[lenIndices] = {false}; + bool checked_index[MAX_INDICES] = {false}; for (int z = 0; z < lenIndices; z++) { if (!checked_index[z]) { for (int y = z+1; y < lenIndices; y++) { @@ -387,7 +388,7 @@ bool Equihash::OptimisedSolve(const eh_HashState& base_state, // First run the algorithm with truncated indices - eh_index soln_size { 1 << K }; + const eh_index soln_size { 1 << K }; std::vector> partialSolns; int invalidCount = 0; { @@ -432,8 +433,8 @@ bool Equihash::OptimisedSolve(const eh_HashState& base_state, hashLen, lenIndices, CollisionByteLength}; if (!(Xi.IsZero(hashLen-CollisionByteLength) && - IsProbablyDuplicate(Xi.GetTruncatedIndices(hashLen-CollisionByteLength, 2*lenIndices), - 2*lenIndices))) { + IsProbablyDuplicate(Xi.GetTruncatedIndices(hashLen-CollisionByteLength, 2*lenIndices), + 2*lenIndices))) { Xc.emplace_back(Xi); } }