From 9289d38d19adafa4a0ee1f5ea9dc5e45494a7875 Mon Sep 17 00:00:00 2001 From: Wisdom Ogwu Date: Mon, 4 Sep 2023 18:15:17 +0100 Subject: [PATCH] add last key to subquery path only after subquery path verification --- grovedb/src/operations/proof/verify.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grovedb/src/operations/proof/verify.rs b/grovedb/src/operations/proof/verify.rs index 60b954dc..ac13306c 100644 --- a/grovedb/src/operations/proof/verify.rs +++ b/grovedb/src/operations/proof/verify.rs @@ -678,7 +678,6 @@ impl ProofVerifier { ProofTokenType::Merk | ProofTokenType::SizedMerk => { let mut key_as_query = Query::new(); key_as_query.insert_key(last_key.to_owned()); - current_path.push(last_key); let verification_result = self.execute_merk_proof( proof_token_type, @@ -688,6 +687,8 @@ impl ProofVerifier { current_path.to_owned(), )?; + current_path.push(last_key); + Ok((verification_result.0, verification_result.1, false)) } _ => Err(Error::InvalidProof(