Optimize transaction creation #98
1 changed files with 7 additions and 0 deletions
|
@ -1844,6 +1844,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
let trans_input: Vec<HtransparentInput> = marshall_from_haskell_var(t_input, t_input_len, RW);
|
let trans_input: Vec<HtransparentInput> = marshall_from_haskell_var(t_input, t_input_len, RW);
|
||||||
for t_in in trans_input {
|
for t_in in trans_input {
|
||||||
if t_in.sk.len() > 1 {
|
if t_in.sk.len() > 1 {
|
||||||
|
println!("t inp: {:?}", t_in);
|
||||||
let k = SecretKey::from_slice(&t_in.sk).unwrap();
|
let k = SecretKey::from_slice(&t_in.sk).unwrap();
|
||||||
if net {
|
if net {
|
||||||
match main_builder.add_transparent_input(k, t_in.utxo.unpack(), t_in.coin.unpack()) {
|
match main_builder.add_transparent_input(k, t_in.utxo.unpack(), t_in.coin.unpack()) {
|
||||||
|
@ -1866,6 +1867,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
}
|
}
|
||||||
for s_in in sap_input {
|
for s_in in sap_input {
|
||||||
if s_in.sk.len() > 1 {
|
if s_in.sk.len() > 1 {
|
||||||
|
println!("s inp: {:?}", s_in);
|
||||||
let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk);
|
let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk);
|
||||||
match sp_key {
|
match sp_key {
|
||||||
Ok(sk) => {
|
Ok(sk) => {
|
||||||
|
@ -1912,6 +1914,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
}
|
}
|
||||||
for o_in in orch_input {
|
for o_in in orch_input {
|
||||||
if o_in.sk.len() > 1 {
|
if o_in.sk.len() > 1 {
|
||||||
|
println!("o inp: {:?}", o_in);
|
||||||
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();
|
||||||
let pay_addr = OrchardAddress::from_raw_address_bytes(&to_array(o_in.note.recipient)).unwrap();
|
let pay_addr = OrchardAddress::from_raw_address_bytes(&to_array(o_in.note.recipient)).unwrap();
|
||||||
let rho = Rho::from_bytes(&to_array(o_in.note.rho)).unwrap();
|
let rho = Rho::from_bytes(&to_array(o_in.note.rho)).unwrap();
|
||||||
|
@ -1952,6 +1955,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
1 => {
|
1 => {
|
||||||
let recipient = TransparentAddress::PublicKeyHash(to_array(output.to));
|
let recipient = TransparentAddress::PublicKeyHash(to_array(output.to));
|
||||||
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
||||||
|
println!("t out: {:?} {:?}", val, output.chg);
|
||||||
if net {
|
if net {
|
||||||
let _mb = main_builder.add_transparent_output(&recipient, val);
|
let _mb = main_builder.add_transparent_output(&recipient, val);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1961,6 +1965,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
2 => {
|
2 => {
|
||||||
let recipient = TransparentAddress::ScriptHash(to_array(output.to));
|
let recipient = TransparentAddress::ScriptHash(to_array(output.to));
|
||||||
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
||||||
|
println!("t out: {:?} {:?}", val, output.chg);
|
||||||
if net {
|
if net {
|
||||||
let _mb = main_builder.add_transparent_output(&recipient, val);
|
let _mb = main_builder.add_transparent_output(&recipient, val);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1972,6 +1977,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
let recipient = PaymentAddress::from_bytes(&to_array(output.to)).unwrap();
|
let recipient = PaymentAddress::from_bytes(&to_array(output.to)).unwrap();
|
||||||
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
let val = NonNegativeAmount::from_u64(output.amt).unwrap();
|
||||||
let memo = MemoBytes::from_bytes(&output.memo).unwrap();
|
let memo = MemoBytes::from_bytes(&output.memo).unwrap();
|
||||||
|
println!("s out: {:?} {:?}", val, output.chg);
|
||||||
if net {
|
if net {
|
||||||
let _mb = main_builder.add_sapling_output::<String>(ovk, recipient, val, memo);
|
let _mb = main_builder.add_sapling_output::<String>(ovk, recipient, val, memo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1987,6 +1993,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
};
|
};
|
||||||
let recipient = OrchardAddress::from_raw_address_bytes(&to_array(output.to)).unwrap();
|
let recipient = OrchardAddress::from_raw_address_bytes(&to_array(output.to)).unwrap();
|
||||||
let val = output.amt;
|
let val = output.amt;
|
||||||
|
println!("o out: {:?} {:?}", val, output.chg);
|
||||||
let memo = MemoBytes::from_bytes(&output.memo).unwrap();
|
let memo = MemoBytes::from_bytes(&output.memo).unwrap();
|
||||||
if net {
|
if net {
|
||||||
let _mb = main_builder.add_orchard_output::<String>(ovk, recipient, val, memo);
|
let _mb = main_builder.add_orchard_output::<String>(ovk, recipient, val, memo);
|
||||||
|
|
Loading…
Reference in a new issue