Transaction creation updates #78

Merged
pitmutt merged 10 commits from rav001 into dev040 2024-05-02 19:59:26 +00:00
Showing only changes of commit 1e31bb73c2 - Show all commits

View file

@ -1668,12 +1668,10 @@ pub extern "C" fn rust_wrapper_create_transaction(
None
}
};
println!("{:?}", 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 test_builder = Builder::new(TestNetwork, BlockHeight::from(bl_height), build_config);
let trans_input: Vec<HtransparentInput> = marshall_from_haskell_var(t_input, t_input_len, RW);
println!("{:?}", trans_input);
for t_in in trans_input {
if t_in.sk.len() > 1 {
let k = SecretKey::from_slice(&t_in.sk).unwrap();
@ -1697,7 +1695,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
}
}
let sap_input: Vec<HsaplingInput> = marshall_from_haskell_var(s_input, s_input_len, RW);
println!("{:?}", sap_input);
for s_in in sap_input {
if s_in.sk.len() > 1 {
let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk);
@ -1726,7 +1723,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
}
}
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
println!("{:?}", orch_input);
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();
@ -1746,7 +1742,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
}
}
let outputs: Vec<Houtput> = marshall_from_haskell_var(out_list, out_list_len, RW);
println!("{:?}", outputs);
for output in outputs {
match output.kind {
1 => {
@ -1791,10 +1786,8 @@ pub extern "C" fn rust_wrapper_create_transaction(
let memo = MemoBytes::from_bytes(&output.memo).unwrap();
if net {
let _mb = main_builder.add_orchard_output::<String>(ovk, recipient, val, memo);
println!("added o-input to main");
} else {
let _tb = test_builder.add_orchard_output::<String>(ovk, recipient, val, memo);
println!("added o-input to test");
}
},
_ => {
@ -1808,12 +1801,9 @@ pub extern "C" fn rust_wrapper_create_transaction(
let output_params_in: Vec<u8> = marshall_from_haskell_var(sapoutput, sapoutput_len, RW);
let output_params_reader = Cursor::new(output_params_in);
let output_prover = OutputParameters::read(output_params_reader, false).unwrap();
println!("loaded params");
let result = if net {
println!("started main build");
main_builder.build(OsRng, &spend_prover, &output_prover, &FeeRule::standard())
} else {
println!("started test build");
test_builder.build(OsRng, &spend_prover, &output_prover, &FeeRule::standard())
};
match result {