Functions to handle commitment tree nodes for Sapling and Orchard #100

Merged
pitmutt merged 50 commits from rav001 into milestone2 2024-11-15 18:48:36 +00:00
Showing only changes of commit 442d2adfad - Show all commits

View file

@ -2145,20 +2145,20 @@ pub extern "C" fn rust_wrapper_create_transaction(
out_len: &mut usize){ out_len: &mut usize){
let sap_input: Vec<HsaplingInput> = marshall_from_haskell_var(s_input, s_input_len, RW); let sap_input: Vec<HsaplingInput> = marshall_from_haskell_var(s_input, s_input_len, RW);
let sap_anchor_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW); let sap_anchor_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW);
let sap_anchor = SaplingAnchor::from_bytes(to_array(sap_anchor_in)); let sap_anchor = Node::from_bytes(to_array(sap_anchor_in));
let sapling_anchor = let sapling_anchor =
if sap_anchor.is_some().into() { if sap_anchor.is_some().into() {
Some(sap_anchor.unwrap()) Some(SaplingAnchor::from(sap_anchor.unwrap()))
} else { } else {
None None
}; };
println!("{:?}", sapling_anchor); println!("{:?}", sapling_anchor);
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW); let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
let orch_anchor_in : Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW); let orch_anchor_in : Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
let orch_anchor = OrchardAnchor::from_bytes(to_array(orch_anchor_in)); let orch_anchor = MerkleHashOrchard::from_bytes(&to_array(orch_anchor_in));
let orchard_anchor = let orchard_anchor =
if orch_anchor.is_some().into() { if orch_anchor.is_some().into() {
Some(orch_anchor.unwrap()) Some(OrchardAnchor::from(orch_anchor.unwrap()))
} else { } else {
None None
}; };