Support for Zebra 2.1.0 #102
3 changed files with 35 additions and 0 deletions
|
@ -1542,6 +1542,25 @@ pub extern "C" fn rust_wrapper_update_sapling_witness(
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_wrapper_read_sapling_node(
|
||||
cmu: *const u8,
|
||||
cmu_len: usize,
|
||||
out: *mut u8,
|
||||
out_len: &mut usize
|
||||
){
|
||||
let node_in: Vec<u8> = marshall_from_haskell_var(cmu, cmu_len, RW);
|
||||
let sapling_note_comm = SaplingNoteCommitment::from_bytes(&to_array(node_in));
|
||||
if sapling_note_comm.is_some().into() {
|
||||
let n = Node::from_cmu(&sapling_note_comm.unwrap());
|
||||
let h = Hhex { bytes: n.to_bytes().to_vec()};
|
||||
marshall_to_haskell_var(&h, out, out_len, RW);
|
||||
} else {
|
||||
let h0 = Hhex { bytes: vec![0] };
|
||||
marshall_to_haskell_var(&h0, out, out_len, RW);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_wrapper_read_orchard_frontier(
|
||||
tree: *const u8,
|
||||
|
|
|
@ -246,6 +246,13 @@ import ZcashHaskell.Types
|
|||
-> `()'
|
||||
#}
|
||||
|
||||
{# fun unsafe rust_wrapper_read_sapling_node as rustWrapperReadSaplingNode
|
||||
{ toBorshVar* `BS.ByteString'&
|
||||
, getVarBuffer `Buffer HexString'&
|
||||
}
|
||||
-> `()'
|
||||
#}
|
||||
|
||||
{# fun unsafe rust_wrapper_read_orchard_node as rustWrapperReadOrchardNode
|
||||
{ toBorshVar* `BS.ByteString'&
|
||||
, getVarBuffer `Buffer HexString'&
|
||||
|
|
|
@ -22,6 +22,7 @@ import C.Zcash
|
|||
, rustWrapperIsShielded
|
||||
, rustWrapperReadSaplingCommitmentTree
|
||||
, rustWrapperReadSaplingFrontier
|
||||
, rustWrapperReadSaplingNode
|
||||
, rustWrapperReadSaplingPosition
|
||||
, rustWrapperReadSaplingWitness
|
||||
, rustWrapperSaplingCheck
|
||||
|
@ -185,6 +186,14 @@ genSaplingInternalAddress sk =
|
|||
res =
|
||||
withPureBorshVarBuffer (rustWrapperSaplingChgPaymentAddress $ getBytes sk)
|
||||
|
||||
getSaplingNodeValue :: BS.ByteString -> Maybe HexString
|
||||
getSaplingNodeValue cmu =
|
||||
if BS.length (hexBytes n) > 1
|
||||
then Just n
|
||||
else Nothing
|
||||
where
|
||||
n = withPureBorshVarBuffer $ rustWrapperReadSaplingNode cmu
|
||||
|
||||
getSaplingFrontier :: SaplingCommitmentTree -> Maybe SaplingFrontier
|
||||
getSaplingFrontier tree =
|
||||
if sf_pos updatedTree > 1
|
||||
|
|
Loading…
Reference in a new issue