Compare commits
2 commits
bea4d2f071
...
5fd33e7e43
Author | SHA1 | Date | |
---|---|---|---|
5fd33e7e43 | |||
8dbcf58a93 |
1 changed files with 13 additions and 0 deletions
|
@ -1656,6 +1656,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
|||
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: Option<IncrementalWitness<MerkleHashOrchard, 32>> = read_incremental_witness(orch_wit_reader).ok();
|
||||
|
@ -1667,16 +1668,19 @@ 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();
|
||||
if net {
|
||||
match main_builder.add_transparent_input(k, t_in.utxo.unpack(), t_in.coin.unpack()) {
|
||||
Ok(()) => {
|
||||
println!("added t-input in main");
|
||||
continue;
|
||||
},
|
||||
Err(_e) => { println!("Error reading transparent input"); }
|
||||
|
@ -1684,6 +1688,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
|||
} else {
|
||||
match test_builder.add_transparent_input(k, t_in.utxo.unpack(), t_in.coin.unpack()) {
|
||||
Ok(()) => {
|
||||
println!("added t-input in test");
|
||||
continue;
|
||||
},
|
||||
Err(_e) => { println!("Error reading transparent input"); }
|
||||
|
@ -1692,6 +1697,7 @@ 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);
|
||||
|
@ -1720,6 +1726,7 @@ 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();
|
||||
|
@ -1739,6 +1746,7 @@ 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 => {
|
||||
|
@ -1782,8 +1790,10 @@ 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");
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
|
@ -1797,9 +1807,12 @@ 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, true).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 {
|
||||
|
|
Loading…
Reference in a new issue