fix length checks so that it fails if one of the conditions fail

This commit is contained in:
gmega 2026-04-30 17:34:54 -03:00
parent 76c4b23c62
commit c3805c256c
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18

View File

@ -65,7 +65,7 @@ func verify*(self: StorageMerkleProof, leaf: MultiHash, root: MultiHash): ?!bool
if self.mcodec != root.mcodec or self.mcodec != leaf.mcodec:
return failure "Hash codec mismatch"
if rootBytes.len != root.size and leafBytes.len != leaf.size:
if rootBytes.len != root.size or leafBytes.len != leaf.size:
return failure "Invalid hash length"
self.verify(leafBytes, rootBytes)