Skip to content

Commit

Permalink
test(tree): Verify membership proof when testing get
Browse files Browse the repository at this point in the history
  • Loading branch information
jns-ps committed Oct 9, 2024
1 parent 59ebbd3 commit ae4cce0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/common/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,13 @@ mod tests {
let insert_proof = tree_state.insert_account(account.clone()).unwrap();
assert!(insert_proof.verify().is_ok());

let get_result = tree_state.tree.get(account.key_hash).unwrap();
assert!(
matches!(get_result, HashchainResponse::Found(hashchain, _) if hashchain == account.hashchain)
);
let Found(hashchain, membership_proof) = tree_state.tree.get(account.key_hash).unwrap()
else {
panic!("Expected hashchain to be found, but was not found.")
};

assert_eq!(hashchain, account.hashchain);
assert!(membership_proof.verify().is_ok());
}

#[test]
Expand Down

0 comments on commit ae4cce0

Please sign in to comment.