Add more debugging to Rust
This commit is contained in:
parent
5fd33e7e43
commit
c144a6d624
1 changed files with 30 additions and 30 deletions
|
@ -170,7 +170,7 @@ use bech32::{
|
||||||
pub enum RW {}
|
pub enum RW {}
|
||||||
pub const RW: PhantomData<RW> = PhantomData;
|
pub const RW: PhantomData<RW> = PhantomData;
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct RawData {
|
pub struct RawData {
|
||||||
hrp: Vec<u8>,
|
hrp: Vec<u8>,
|
||||||
bytes: Vec<u8>
|
bytes: Vec<u8>
|
||||||
|
@ -190,7 +190,7 @@ impl<RW> ToHaskell<RW> for RawData {
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HrawTx {
|
pub struct HrawTx {
|
||||||
bytes: Vec<u8>,
|
bytes: Vec<u8>,
|
||||||
s: bool,
|
s: bool,
|
||||||
|
@ -204,7 +204,7 @@ impl<RW> ToHaskell<RW> for HrawTx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HshieldedOutput {
|
pub struct HshieldedOutput {
|
||||||
pub cv: Hhex,
|
pub cv: Hhex,
|
||||||
cmu: Hhex,
|
cmu: Hhex,
|
||||||
|
@ -248,7 +248,7 @@ impl HshieldedOutput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hhex {
|
pub struct Hhex {
|
||||||
bytes: Vec<u8>
|
bytes: Vec<u8>
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ impl<RW> ToHaskell<RW> for Hhex {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Haction {
|
pub struct Haction {
|
||||||
nf: Hhex,
|
nf: Hhex,
|
||||||
rk: Hhex,
|
rk: Hhex,
|
||||||
|
@ -290,7 +290,7 @@ impl Haction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hnote {
|
pub struct Hnote {
|
||||||
note: u64,
|
note: u64,
|
||||||
recipient: Vec<u8>,
|
recipient: Vec<u8>,
|
||||||
|
@ -307,7 +307,7 @@ impl<RW> ToHaskell<RW> for Hnote {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hrseed {
|
pub struct Hrseed {
|
||||||
kind: u8,
|
kind: u8,
|
||||||
bytes: Vec<u8>
|
bytes: Vec<u8>
|
||||||
|
@ -328,7 +328,7 @@ impl<RW> ToHaskell<RW> for Hrseed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hua {
|
pub struct Hua {
|
||||||
net: u8,
|
net: u8,
|
||||||
o_rec: Vec<u8>,
|
o_rec: Vec<u8>,
|
||||||
|
@ -361,7 +361,7 @@ impl Hua {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Htx {
|
pub struct Htx {
|
||||||
txid: Vec<u8>,
|
txid: Vec<u8>,
|
||||||
locktime: u32,
|
locktime: u32,
|
||||||
|
@ -379,7 +379,7 @@ impl<RW> ToHaskell<RW> for Htx {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HTBundle {
|
pub struct HTBundle {
|
||||||
empty: bool,
|
empty: bool,
|
||||||
vin: Vec<HTxIn>,
|
vin: Vec<HTxIn>,
|
||||||
|
@ -400,7 +400,7 @@ impl HTBundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HTxIn {
|
pub struct HTxIn {
|
||||||
outpoint: Houtpoint,
|
outpoint: Houtpoint,
|
||||||
script: Vec<u8>,
|
script: Vec<u8>,
|
||||||
|
@ -420,7 +420,7 @@ impl HTxIn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HTxOut {
|
pub struct HTxOut {
|
||||||
amt: i64,
|
amt: i64,
|
||||||
script: Vec<u8>
|
script: Vec<u8>
|
||||||
|
@ -449,7 +449,7 @@ impl HTxOut {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Houtpoint {
|
pub struct Houtpoint {
|
||||||
hash: Vec<u8>,
|
hash: Vec<u8>,
|
||||||
index: u32
|
index: u32
|
||||||
|
@ -479,7 +479,7 @@ impl Houtpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HtransparentInput {
|
pub struct HtransparentInput {
|
||||||
sk: Vec<u8>,
|
sk: Vec<u8>,
|
||||||
utxo: Houtpoint,
|
utxo: Houtpoint,
|
||||||
|
@ -500,7 +500,7 @@ impl<RW> ToHaskell<RW> for HtransparentInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HSBundle {
|
pub struct HSBundle {
|
||||||
empty: bool,
|
empty: bool,
|
||||||
spends: Vec<Hspend>,
|
spends: Vec<Hspend>,
|
||||||
|
@ -523,7 +523,7 @@ impl HSBundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hspend {
|
pub struct Hspend {
|
||||||
cv: Hhex,
|
cv: Hhex,
|
||||||
anchor: Hhex,
|
anchor: Hhex,
|
||||||
|
@ -552,7 +552,7 @@ impl Hspend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HsaplingInput {
|
pub struct HsaplingInput {
|
||||||
sk: Vec<u8>,
|
sk: Vec<u8>,
|
||||||
note: Hnote,
|
note: Hnote,
|
||||||
|
@ -567,7 +567,7 @@ impl<RW> FromHaskell<RW> for HsaplingInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HorchardInput {
|
pub struct HorchardInput {
|
||||||
sk: Vec<u8>,
|
sk: Vec<u8>,
|
||||||
note: Hnote,
|
note: Hnote,
|
||||||
|
@ -581,7 +581,7 @@ impl<RW> FromHaskell<RW> for HorchardInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Houtput {
|
pub struct Houtput {
|
||||||
kind: u8,
|
kind: u8,
|
||||||
ovk: Vec<u8>,
|
ovk: Vec<u8>,
|
||||||
|
@ -598,7 +598,7 @@ impl<RW> FromHaskell<RW> for Houtput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct HOBundle {
|
pub struct HOBundle {
|
||||||
empty: bool,
|
empty: bool,
|
||||||
actions: Vec<Haction>,
|
actions: Vec<Haction>,
|
||||||
|
@ -623,7 +623,7 @@ impl HOBundle {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hflags {
|
pub struct Hflags {
|
||||||
spends: bool,
|
spends: bool,
|
||||||
outputs: bool
|
outputs: bool
|
||||||
|
@ -642,7 +642,7 @@ impl Hflags {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hufvk {
|
pub struct Hufvk {
|
||||||
net: u8,
|
net: u8,
|
||||||
orchard: Vec<u8>,
|
orchard: Vec<u8>,
|
||||||
|
@ -671,7 +671,7 @@ impl Hufvk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BorshSerialize, BorshDeserialize)]
|
#[derive(Debug, BorshSerialize, BorshDeserialize)]
|
||||||
pub struct Hsvk {
|
pub struct Hsvk {
|
||||||
vk: Vec<u8>,
|
vk: Vec<u8>,
|
||||||
ovk: Vec<u8>
|
ovk: Vec<u8>
|
||||||
|
@ -795,7 +795,7 @@ pub extern "C" fn rust_wrapper_svk_decode(
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print!("{}", e);
|
print!("{:?}", e);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1656,7 +1656,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
println!(sap_anchor);
|
println!("{:?}", sap_anchor);
|
||||||
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: Option<IncrementalWitness<MerkleHashOrchard, 32>> = read_incremental_witness(orch_wit_reader).ok();
|
let orch_iw: Option<IncrementalWitness<MerkleHashOrchard, 32>> = read_incremental_witness(orch_wit_reader).ok();
|
||||||
|
@ -1668,12 +1668,12 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
println!(orch_anchor);
|
println!("{:?}", orch_anchor);
|
||||||
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);
|
||||||
let mut test_builder = Builder::new(TestNetwork, 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);
|
let trans_input: Vec<HtransparentInput> = marshall_from_haskell_var(t_input, t_input_len, RW);
|
||||||
println!(trans_input);
|
println!("{:?}", trans_input);
|
||||||
for t_in in trans_input {
|
for t_in in trans_input {
|
||||||
if t_in.sk.len() > 1 {
|
if t_in.sk.len() > 1 {
|
||||||
let k = SecretKey::from_slice(&t_in.sk).unwrap();
|
let k = SecretKey::from_slice(&t_in.sk).unwrap();
|
||||||
|
@ -1697,7 +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);
|
let sap_input: Vec<HsaplingInput> = marshall_from_haskell_var(s_input, s_input_len, RW);
|
||||||
println!(sap_input);
|
println!("{:?}", sap_input);
|
||||||
for s_in in sap_input {
|
for s_in in sap_input {
|
||||||
if s_in.sk.len() > 1 {
|
if s_in.sk.len() > 1 {
|
||||||
let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk);
|
let sp_key = ExtendedSpendingKey::from_bytes(&s_in.sk);
|
||||||
|
@ -1726,7 +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);
|
let orch_input: Vec<HorchardInput> = marshall_from_haskell_var(o_input, o_input_len, RW);
|
||||||
println!(orch_input);
|
println!("{:?}", orch_input);
|
||||||
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();
|
||||||
|
@ -1746,7 +1746,7 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let outputs: Vec<Houtput> = marshall_from_haskell_var(out_list, out_list_len, RW);
|
let outputs: Vec<Houtput> = marshall_from_haskell_var(out_list, out_list_len, RW);
|
||||||
println!(outputs);
|
println!("{:?}", outputs);
|
||||||
for output in outputs {
|
for output in outputs {
|
||||||
match output.kind {
|
match output.kind {
|
||||||
1 => {
|
1 => {
|
||||||
|
|
Loading…
Reference in a new issue