Fixed Merkle tree root update

This commit is contained in:
SChernykh
2023-10-25 22:54:25 +02:00
parent a852b4e3ad
commit fc31ac6cd0
5 changed files with 83 additions and 27 deletions

View File

@@ -196,15 +196,17 @@ bool verify_merkle_proof(hash h, const std::vector<std::pair<bool, hash>>& proof
hash get_root_from_proof(hash h, const std::vector<hash>& proof, size_t index, size_t count)
{
if (count == 1) {
return h;
}
if (index >= count) {
return hash();
}
hash tmp[2];
if (count == 1) {
}
else if (count == 2) {
if (count == 2) {
if (proof.empty()) {
return hash();
}