improve error message in Proof::new to include actual lengths

This commit is contained in:
ricecodekhmer 2025-03-30 16:04:06 +01:00 committed by GitHub
parent 74074dfa2f
commit b05f46b9d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ impl<T: HashElement> Proof<T> {
/// Creates new MT inclusion proof
pub fn new(hash: Vec<T>, path: Vec<bool>) -> Result<Proof<T>> {
if hash.len() != path.len() + 2 {
bail!("hash and path length mismatch");
bail!("Proof::new: expected hash length = path.len() + 2, but got {} and {}", hash.len(), path.len());
}
Ok(Proof { lemma: hash, path })
}