Optimize transaction creation #98
1 changed files with 22 additions and 24 deletions
|
@ -1795,43 +1795,41 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
|||
build: bool,
|
||||
out: *mut u8,
|
||||
out_len: &mut usize){
|
||||
//let sap_wit_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW);
|
||||
//let sap_wit_reader = Cursor::new(sap_wit_in);
|
||||
//let sap_iw = read_commitment_tree::<Node, Cursor<Vec<u8>>, SAPLING_DEPTH>(sap_wit_reader);
|
||||
let sap_input: Vec<HsaplingInput> = marshall_from_haskell_var(s_input, s_input_len, RW);
|
||||
let sap_anchor =
|
||||
if sap_input.is_empty() {
|
||||
let sap_wit_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW);
|
||||
let sap_wit_reader = Cursor::new(sap_wit_in);
|
||||
let sap_iw = read_commitment_tree::<Node, Cursor<Vec<u8>>, SAPLING_DEPTH>(sap_wit_reader);
|
||||
match sap_iw {
|
||||
Ok(s_iw) => {
|
||||
Some(SaplingAnchor::from(s_iw.root()))
|
||||
},
|
||||
Err(_e) => {
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let si = &sap_input[0];
|
||||
let swit_reader = Cursor::new(&si.iw);
|
||||
let iw: IncrementalWitness<Node, SAPLING_DEPTH> = read_incremental_witness(swit_reader).unwrap();
|
||||
Some(SaplingAnchor::from(iw.root()))
|
||||
};
|
||||
//let sap_anchor = match sap_iw {
|
||||
//Ok(s_iw) => {
|
||||
//Some(SaplingAnchor::from(s_iw.root()))
|
||||
//},
|
||||
//Err(_e) => {
|
||||
//None
|
||||
//}
|
||||
//};
|
||||
//println!("{:?}", sap_anchor);
|
||||
//let orch_wit_in: Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
|
||||
//let orch_wit_reader = Cursor::new(orch_wit_in);
|
||||
//let orch_iw = read_commitment_tree::<MerkleHashOrchard, Cursor<Vec<u8>>, 32>(orch_wit_reader);
|
||||
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
|
||||
//let orch_anchor = match orch_iw {
|
||||
//Ok(o_iw) => {
|
||||
//Some(OrchardAnchor::from(o_iw.root()))
|
||||
//},
|
||||
//Err(_e) => {
|
||||
//None
|
||||
//}
|
||||
//};
|
||||
let orch_anchor =
|
||||
if orch_input.is_empty() {
|
||||
let orch_wit_in: Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
|
||||
let orch_wit_reader = Cursor::new(orch_wit_in);
|
||||
let orch_iw = read_commitment_tree::<MerkleHashOrchard, Cursor<Vec<u8>>, 32>(orch_wit_reader);
|
||||
match orch_iw {
|
||||
Ok(o_iw) => {
|
||||
Some(OrchardAnchor::from(o_iw.root()))
|
||||
},
|
||||
Err(_e) => {
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let oi = &orch_input[0];
|
||||
let wit_reader = Cursor::new(&oi.iw);
|
||||
|
|
Loading…
Reference in a new issue