From 1492f3b6ad44f8aba2daf3e153dc792c6bab3fbf Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 29 Oct 2024 09:46:24 -0500 Subject: [PATCH] docs: add debugging to create_transaction --- librustzcash-wrapper/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/librustzcash-wrapper/src/lib.rs b/librustzcash-wrapper/src/lib.rs index 1673061..73b52cd 100644 --- a/librustzcash-wrapper/src/lib.rs +++ b/librustzcash-wrapper/src/lib.rs @@ -1844,6 +1844,7 @@ pub extern "C" fn rust_wrapper_create_transaction( let trans_input: Vec = marshall_from_haskell_var(t_input, t_input_len, RW); for t_in in trans_input { if t_in.sk.len() > 1 { + println!("t inp: {:?}", t_in); 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()) { @@ -1866,6 +1867,7 @@ pub extern "C" fn rust_wrapper_create_transaction( } for s_in in sap_input { if s_in.sk.len() > 1 { + println!("s inp: {:?}", s_in); let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk); match sp_key { Ok(sk) => { @@ -1912,6 +1914,7 @@ pub extern "C" fn rust_wrapper_create_transaction( } for o_in in orch_input { 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 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(); @@ -1952,6 +1955,7 @@ pub extern "C" fn rust_wrapper_create_transaction( 1 => { let recipient = TransparentAddress::PublicKeyHash(to_array(output.to)); let val = NonNegativeAmount::from_u64(output.amt).unwrap(); + println!("t out: {:?} {:?}", val, output.chg); if net { let _mb = main_builder.add_transparent_output(&recipient, val); } else { @@ -1961,6 +1965,7 @@ pub extern "C" fn rust_wrapper_create_transaction( 2 => { let recipient = TransparentAddress::ScriptHash(to_array(output.to)); let val = NonNegativeAmount::from_u64(output.amt).unwrap(); + println!("t out: {:?} {:?}", val, output.chg); if net { let _mb = main_builder.add_transparent_output(&recipient, val); } else { @@ -1972,6 +1977,7 @@ pub extern "C" fn rust_wrapper_create_transaction( let recipient = PaymentAddress::from_bytes(&to_array(output.to)).unwrap(); let val = NonNegativeAmount::from_u64(output.amt).unwrap(); let memo = MemoBytes::from_bytes(&output.memo).unwrap(); + println!("s out: {:?} {:?}", val, output.chg); if net { let _mb = main_builder.add_sapling_output::(ovk, recipient, val, memo); } 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 val = output.amt; + println!("o out: {:?} {:?}", val, output.chg); let memo = MemoBytes::from_bytes(&output.memo).unwrap(); if net { let _mb = main_builder.add_orchard_output::(ovk, recipient, val, memo);