Support for Zebra 2.1.0 #102
3 changed files with 18 additions and 9 deletions
|
@ -1563,12 +1563,20 @@ pub extern "C" fn rust_wrapper_read_orchard_tree_anchor(
|
|||
out: *mut u8,
|
||||
out_len: &mut usize
|
||||
){
|
||||
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 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();
|
||||
let tree_in: Vec<u8> = marshall_from_haskell_var(tree, tree_len, RW);
|
||||
let tree_reader = Cursor::new(tree_in);
|
||||
let comm_tree = read_commitment_tree(tree_reader);
|
||||
match comm_tree {
|
||||
Ok::<CommitmentTree<MerkleHashOrchard, 32>, _>(c1) => {
|
||||
let root = c1.root();
|
||||
let h = Hhex { bytes: root.to_bytes().to_vec() };
|
||||
marshall_to_haskell_var(&h, out, out_len, RW);
|
||||
},
|
||||
Err(_) => {
|
||||
let h0 = Hhex { bytes: vec![0] };
|
||||
marshall_to_haskell_var(&h0, out, out_len, RW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
@ -263,7 +263,7 @@ import ZcashHaskell.Types
|
|||
#}
|
||||
|
||||
{# fun unsafe rust_wrapper_read_orchard_tree_anchor as rustWrapperReadOrchardTreeAnchor
|
||||
{ toBorshVar* `OrchardFrontier'&
|
||||
{ toBorshVar* `BS.ByteString'&
|
||||
, getVarBuffer `Buffer HexString'&
|
||||
}
|
||||
-> `()'
|
||||
|
|
|
@ -212,9 +212,10 @@ getOrchardFrontier tree =
|
|||
withPureBorshVarBuffer $
|
||||
rustWrapperReadOrchardFrontier $ toBytes $ orchTree tree
|
||||
|
||||
getOrchardTreeAnchor :: OrchardFrontier -> HexString
|
||||
getOrchardTreeAnchor :: OrchardCommitmentTree -> HexString
|
||||
getOrchardTreeAnchor tree =
|
||||
withPureBorshVarBuffer $ rustWrapperReadOrchardTreeAnchor tree
|
||||
withPureBorshVarBuffer $
|
||||
rustWrapperReadOrchardTreeAnchor $ toBytes $ orchTree tree
|
||||
|
||||
getOrchardWitnessAnchor :: OrchardWitness -> HexString
|
||||
getOrchardWitnessAnchor wit =
|
||||
|
|
Loading…
Reference in a new issue