From 37b485288d0cf8999e35c24382dd9c69a4a4a00a Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 7 May 2024 15:19:54 -0500 Subject: [PATCH] Fix bug in Orchard witness calculation --- librustzcash-wrapper/src/lib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/librustzcash-wrapper/src/lib.rs b/librustzcash-wrapper/src/lib.rs index 9956dde..bc234f5 100644 --- a/librustzcash-wrapper/src/lib.rs +++ b/librustzcash-wrapper/src/lib.rs @@ -1562,17 +1562,17 @@ pub extern "C" fn rust_wrapper_update_orchard_witness( let n = MerkleHashOrchard::from_cmx(&orchard_note_comm.unwrap()); iw.append(n); } - let mut out_bytes: Vec = Vec::new(); - let result = write_incremental_witness(&iw, &mut out_bytes); - match result { - Ok(()) => { - let h = Hhex { bytes: out_bytes}; - marshall_to_haskell_var(&h, out, out_len, RW); - }, - Err(_e) => { - let h0 = Hhex { bytes: vec![0]}; - marshall_to_haskell_var(&h0, out, out_len, RW); - } + } + let mut out_bytes: Vec = Vec::new(); + let result = write_incremental_witness(&iw, &mut out_bytes); + match result { + Ok(()) => { + let h = Hhex { bytes: out_bytes}; + marshall_to_haskell_var(&h, out, out_len, RW); + }, + Err(_e) => { + let h0 = Hhex { bytes: vec![0]}; + marshall_to_haskell_var(&h0, out, out_len, RW); } } }