refactor: use thiserror to derive errors and update error messages (#344)

This commit is contained in:
Philipp Gackstatter
2024-11-22 00:52:20 +01:00
committed by GitHub
parent 50dd6bda19
commit a27f9ad828
22 changed files with 392 additions and 347 deletions

View File

@@ -61,7 +61,10 @@ impl MerklePath {
pub fn verify(&self, index: u64, node: RpoDigest, root: &RpoDigest) -> Result<(), MerkleError> {
let computed_root = self.compute_root(index, node)?;
if &computed_root != root {
return Err(MerkleError::ConflictingRoots(vec![computed_root, *root]));
return Err(MerkleError::ConflictingRoots {
expected_root: *root,
actual_root: computed_root,
});
}
Ok(())