Milestone 3 #101

Merged
pitmutt merged 46 commits from milestone2 into master 2024-11-21 14:19:43 +00:00
Showing only changes of commit 3969490283 - Show all commits

View file

@ -1702,13 +1702,23 @@ pub extern "C" fn rust_wrapper_create_transaction(
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_anchor = match orch_iw {
Ok(o_iw) => {
Some(OrchardAnchor::from(o_iw.root()))
},
Err(_e) => {
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() {
None
}
} else {
let oi = &orch_input[0];
let wit_reader = Cursor::new(&oi.iw);
let iw: IncrementalWitness<MerkleHashOrchard, 32> = read_incremental_witness(wit_reader).unwrap();
Some(OrchardAnchor::from(iw.root()))
};
let build_config = BuildConfig::Standard {sapling_anchor: sap_anchor, orchard_anchor: orch_anchor};
let mut main_builder = Builder::new(MainNetwork, BlockHeight::from(bl_height), build_config);
@ -1764,7 +1774,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
}
}
}
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
for o_in in orch_input {
if o_in.sk.len() > 1 {
let sp_key = SpendingKey::from_bytes(o_in.sk[0..32].try_into().unwrap()).unwrap();