modify tree root validation

This commit is contained in:
Rene Vergara 2024-10-31 09:28:34 -05:00
parent 1938e162f4
commit 92cc2aabe4
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -1538,8 +1538,8 @@ pub extern "C" fn rust_wrapper_read_orchard_tree_anchor(
){ ){
let tree_in: Hfrontier = marshall_from_haskell_var(tree, tree_len, RW); let tree_in: Hfrontier = marshall_from_haskell_var(tree, tree_len, RW);
let leaf = MerkleHashOrchard::from_bytes(&to_array(tree_in.leaf.bytes)).unwrap(); let leaf = MerkleHashOrchard::from_bytes(&to_array(tree_in.leaf.bytes)).unwrap();
let comm_tree: NonEmptyFrontier<MerkleHashOrchard> = NonEmptyFrontier::from_parts(Position::from(tree_in.position), leaf, tree_in.ommers.iter().map(|x| MerkleHashOrchard::from_bytes(&to_array(x.bytes.clone())).unwrap() ).collect()).unwrap(); let comm_tree: Frontier<MerkleHashOrchard,32> = Frontier::from_parts(Position::from(tree_in.position), leaf, tree_in.ommers.iter().map(|x| MerkleHashOrchard::from_bytes(&to_array(x.bytes.clone())).unwrap() ).collect()).unwrap();
let root = comm_tree.root(None); let root = comm_tree.root();
let h = Hhex { bytes: root.to_bytes().to_vec() }; let h = Hhex { bytes: root.to_bytes().to_vec() };
marshall_to_haskell_var(&h, out, out_len, RW); marshall_to_haskell_var(&h, out, out_len, RW);
} }