From d5a9fb8d0e2eedfe256130b1c37bd8e81e1a3402 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 24 Oct 2023 10:55:08 +0200 Subject: [PATCH] Fixed cppcheck error --- src/merkle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/merkle.cpp b/src/merkle.cpp index 8fbced0..fec00a2 100644 --- a/src/merkle.cpp +++ b/src/merkle.cpp @@ -231,23 +231,23 @@ bool verify_merkle_proof(hash h, const std::vector& proof, size_t index, s if (index >= k) { index -= k; - if (proof_index >= proof.size()) { + if (proof.empty()) { return false; } if (index & 1) { - tmp[0] = proof[proof_index]; + tmp[0] = proof[0]; tmp[1] = h; } else { tmp[0] = h; - tmp[1] = proof[proof_index]; + tmp[1] = proof[0]; } keccak(tmp[0].h, HASH_SIZE * 2, h.h); index = (index >> 1) + k; - ++proof_index; + proof_index = 1; } for (; cnt >= 2; ++proof_index, index >>= 1, cnt >>= 1) {