Fixed cppcheck error

This commit is contained in:
SChernykh 2023-10-24 10:55:08 +02:00
parent b8c68dc2e4
commit d5a9fb8d0e

View file

@ -231,23 +231,23 @@ bool verify_merkle_proof(hash h, const std::vector<hash>& proof, size_t index, s
if (index >= k) { if (index >= k) {
index -= k; index -= k;
if (proof_index >= proof.size()) { if (proof.empty()) {
return false; return false;
} }
if (index & 1) { if (index & 1) {
tmp[0] = proof[proof_index]; tmp[0] = proof[0];
tmp[1] = h; tmp[1] = h;
} }
else { else {
tmp[0] = h; tmp[0] = h;
tmp[1] = proof[proof_index]; tmp[1] = proof[0];
} }
keccak(tmp[0].h, HASH_SIZE * 2, h.h); keccak(tmp[0].h, HASH_SIZE * 2, h.h);
index = (index >> 1) + k; index = (index >> 1) + k;
++proof_index; proof_index = 1;
} }
for (; cnt >= 2; ++proof_index, index >>= 1, cnt >>= 1) { for (; cnt >= 2; ++proof_index, index >>= 1, cnt >>= 1) {