Fix bug in Orchard witness calculation

This commit is contained in:
Rene Vergara 2024-05-07 15:19:54 -05:00
parent 302a2f87fa
commit 37b485288d
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -1562,17 +1562,17 @@ pub extern "C" fn rust_wrapper_update_orchard_witness(
let n = MerkleHashOrchard::from_cmx(&orchard_note_comm.unwrap()); let n = MerkleHashOrchard::from_cmx(&orchard_note_comm.unwrap());
iw.append(n); iw.append(n);
} }
let mut out_bytes: Vec<u8> = Vec::new(); }
let result = write_incremental_witness(&iw, &mut out_bytes); let mut out_bytes: Vec<u8> = Vec::new();
match result { let result = write_incremental_witness(&iw, &mut out_bytes);
Ok(()) => { match result {
let h = Hhex { bytes: out_bytes}; Ok(()) => {
marshall_to_haskell_var(&h, out, out_len, RW); let h = Hhex { bytes: out_bytes};
}, marshall_to_haskell_var(&h, out, out_len, RW);
Err(_e) => { },
let h0 = Hhex { bytes: vec![0]}; Err(_e) => {
marshall_to_haskell_var(&h0, out, out_len, RW); let h0 = Hhex { bytes: vec![0]};
} marshall_to_haskell_var(&h0, out, out_len, RW);
} }
} }
} }