Addition of functinality for manipulating Unified Addresses and Viewing Keys #1
1 changed files with 18 additions and 10 deletions
|
@ -364,10 +364,12 @@ pub extern "C" fn rust_wrapper_sapling_note_decrypt_v2(
|
||||||
match svk {
|
match svk {
|
||||||
Ok(k) => {
|
Ok(k) => {
|
||||||
let domain = SaplingDomain::for_height(MainNetwork, BlockHeight::from_u32(2000000));
|
let domain = SaplingDomain::for_height(MainNetwork, BlockHeight::from_u32(2000000));
|
||||||
let action2 = OutputDescription::read(&mut note_reader).unwrap();
|
let action2 = OutputDescription::read(&mut note_reader);
|
||||||
|
match action2 {
|
||||||
|
Ok(action3) => {
|
||||||
let fvk = k.to_diversifiable_full_viewing_key().to_ivk(SaplingScope::External);
|
let fvk = k.to_diversifiable_full_viewing_key().to_ivk(SaplingScope::External);
|
||||||
let pivk = SaplingPreparedIncomingViewingKey::new(&fvk);
|
let pivk = SaplingPreparedIncomingViewingKey::new(&fvk);
|
||||||
let result = zcash_note_encryption::try_note_decryption(&domain, &pivk, &action2);
|
let result = zcash_note_encryption::try_note_decryption(&domain, &pivk, &action3);
|
||||||
match result {
|
match result {
|
||||||
Some((n, r, m)) => {
|
Some((n, r, m)) => {
|
||||||
let hn = Hnote {note: n.value().inner(), recipient: r.to_bytes().to_vec(), memo: m.as_slice().to_vec() };
|
let hn = Hnote {note: n.value().inner(), recipient: r.to_bytes().to_vec(), memo: m.as_slice().to_vec() };
|
||||||
|
@ -378,6 +380,12 @@ pub extern "C" fn rust_wrapper_sapling_note_decrypt_v2(
|
||||||
marshall_to_haskell_var(&hn0, out, out_len, RW);
|
marshall_to_haskell_var(&hn0, out, out_len, RW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Err(_e1) => {
|
||||||
|
let hn0 = Hnote { note: 0, recipient: vec![0], memo: vec![0] };
|
||||||
|
marshall_to_haskell_var(&hn0, out, out_len, RW);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
let hn0 = Hnote { note: 0, recipient: vec![0], memo: vec![0] };
|
let hn0 = Hnote { note: 0, recipient: vec![0], memo: vec![0] };
|
||||||
|
|
Loading…
Reference in a new issue