Correct Sapling outputs parsing

This commit is contained in:
Rene Vergara 2023-09-28 14:50:53 -05:00
parent a6a69ae4cc
commit 697ce83f7c
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
1 changed files with 15 additions and 8 deletions

View File

@ -445,15 +445,22 @@ pub extern "C" fn rust_wrapper_tx_parse(
let parsed_tx = Transaction::read(&mut tx_reader, Nu5);
match parsed_tx {
Ok(t) => {
let s_bundle = t.sapling_bundle().unwrap().shielded_outputs();
let mut s_output = Vec::new();
for s_each_out in s_bundle.iter() {
let mut out_bytes = Vec::new();
let _ = s_each_out.write_v4(&mut out_bytes);
s_output.push(out_bytes);
let s_bundle = t.sapling_bundle();
match s_bundle {
Some(b) => {
let mut s_output = Vec::new();
for s_each_out in b.shielded_outputs().iter() {
let mut out_bytes = Vec::new();
let _ = s_each_out.write_v4(&mut out_bytes);
s_output.push(out_bytes);
}
marshall_to_haskell_var(&s_output, out, out_len, RW);
},
None => {
let z = HrawTx { bytes: vec![0], s: false, o: false};
marshall_to_haskell_var(&z, out, out_len, RW);
}
}
marshall_to_haskell_var(&s_output, out, out_len, RW);
//TODO: write array of bytes
},
Err(_e) => {