Fix merkle multiProof for single leaf tree (#3446)

This commit is contained in:
Hadrien Croubois
2022-06-01 22:21:56 +02:00
committed by GitHub
parent 6766b2de3b
commit 2b0b0bb186
2 changed files with 27 additions and 1 deletions

View File

@ -105,7 +105,13 @@ library MerkleProof {
hashes[i] = _hashPair(a, b);
}
return hashes[totalHashes - 1];
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leafsLen > 0) {
return leafs[0];
} else {
return proofs[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {