Orchard anchor and witness updates #95
1 changed files with 17 additions and 8 deletions
|
@ -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_in: Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
|
||||||
let orch_wit_reader = Cursor::new(orch_wit_in);
|
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_iw = read_commitment_tree::<MerkleHashOrchard, Cursor<Vec<u8>>, 32>(orch_wit_reader);
|
||||||
let orch_anchor = match orch_iw {
|
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
|
||||||
Ok(o_iw) => {
|
//let orch_anchor = match orch_iw {
|
||||||
Some(OrchardAnchor::from(o_iw.root()))
|
//Ok(o_iw) => {
|
||||||
},
|
//Some(OrchardAnchor::from(o_iw.root()))
|
||||||
Err(_e) => {
|
//},
|
||||||
|
//Err(_e) => {
|
||||||
|
//None
|
||||||
|
//}
|
||||||
|
//};
|
||||||
|
let orch_anchor =
|
||||||
|
if orch_input.is_empty() {
|
||||||
None
|
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 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);
|
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 {
|
for o_in in orch_input {
|
||||||
if o_in.sk.len() > 1 {
|
if o_in.sk.len() > 1 {
|
||||||
let sp_key = SpendingKey::from_bytes(o_in.sk[0..32].try_into().unwrap()).unwrap();
|
let sp_key = SpendingKey::from_bytes(o_in.sk[0..32].try_into().unwrap()).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue