From 4de3f95f1f6fca660266749902a21dc3a1fe0457 Mon Sep 17 00:00:00 2001 From: Rostyslav Tyshko Date: Fri, 25 Oct 2024 00:39:55 +0200 Subject: [PATCH] add test_get_membership_proof_not_exists --- utxo/src/utxo_tree.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utxo/src/utxo_tree.rs b/utxo/src/utxo_tree.rs index b696411..9e78aff 100644 --- a/utxo/src/utxo_tree.rs +++ b/utxo/src/utxo_tree.rs @@ -175,5 +175,15 @@ mod tests { assert!(proof.is_some()); } + #[test] + fn test_get_membership_proof_not_exists() { + let mut smt = UTXOSparseMerkleTree::new(); + // Try fetching proof for a non-existent UTXO hash + let non_existent_hash = TreeHashType::default(); + let proof = smt.get_membership_proof(non_existent_hash).unwrap(); + + // Test no proof is generated for a non-existent UTXO + assert!(proof.is_none()); + } }