mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-08-01 12:51:28 +00:00
@@ -4,6 +4,7 @@ use std::cmp;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use rand::{Rng, rngs::OsRng};
|
||||
|
||||
@@ -28,12 +29,13 @@ use zcash_primitives::{
|
||||
block::BlockHash,
|
||||
merkle_tree::{CommitmentTree},
|
||||
serialize::{Vector},
|
||||
consensus::BranchId,
|
||||
transaction::{
|
||||
builder::{Builder},
|
||||
components::{Amount, OutPoint, TxOut}, components::amount::DEFAULT_FEE,
|
||||
TxId, Transaction,
|
||||
},
|
||||
legacy::{Script, TransparentAddress},
|
||||
legacy::{Script, TransparentAddress},
|
||||
note_encryption::{Memo, try_sapling_note_decryption, try_sapling_output_recovery},
|
||||
zip32::{ExtendedFullViewingKey, ExtendedSpendingKey, ChildIndex},
|
||||
JUBJUB,
|
||||
@@ -411,7 +413,7 @@ impl LightWallet {
|
||||
}
|
||||
|
||||
pub fn note_address(hrp: &str, note: &SaplingNoteData) -> Option<String> {
|
||||
match note.extfvk.fvk.vk.into_payment_address(note.diversifier, &JUBJUB) {
|
||||
match note.extfvk.fvk.vk.to_payment_address(note.diversifier, &JUBJUB) {
|
||||
Some(pa) => Some(encode_payment_address(hrp, &pa)),
|
||||
None => None
|
||||
}
|
||||
@@ -793,7 +795,7 @@ impl LightWallet {
|
||||
Some(a) => a == encode_payment_address(
|
||||
self.config.hrp_sapling_address(),
|
||||
&nd.extfvk.fvk.vk
|
||||
.into_payment_address(nd.diversifier, &JUBJUB).unwrap()
|
||||
.to_payment_address(nd.diversifier, &JUBJUB).unwrap()
|
||||
),
|
||||
None => true
|
||||
}
|
||||
@@ -847,7 +849,7 @@ impl LightWallet {
|
||||
Some(a) => a == encode_payment_address(
|
||||
self.config.hrp_sapling_address(),
|
||||
&nd.extfvk.fvk.vk
|
||||
.into_payment_address(nd.diversifier, &JUBJUB).unwrap()
|
||||
.to_payment_address(nd.diversifier, &JUBJUB).unwrap()
|
||||
),
|
||||
None => true
|
||||
}
|
||||
@@ -1542,7 +1544,7 @@ impl LightWallet {
|
||||
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(|e| format!("{}", e))?;
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
|
||||
// Confirm we were able to select sufficient value
|
||||
@@ -1566,7 +1568,7 @@ impl LightWallet {
|
||||
selected.extsk.clone(),
|
||||
selected.diversifier,
|
||||
selected.note.clone(),
|
||||
selected.witness.clone(),
|
||||
selected.witness.path().unwrap(),
|
||||
) {
|
||||
let e = format!("Error adding note: {:?}", e);
|
||||
error!("{}", e);
|
||||
@@ -1590,7 +1592,7 @@ impl LightWallet {
|
||||
// Compute memo if it exists
|
||||
let encoded_memo = match memo {
|
||||
None => None,
|
||||
Some(s) => match Memo::from_str(&s) {
|
||||
Some(s) => match Memo::from_bytes(s.as_bytes()) {
|
||||
None => {
|
||||
let e = format!("Error creating output. Memo {:?} is too long", s);
|
||||
error!("{}", e);
|
||||
@@ -1619,8 +1621,8 @@ impl LightWallet {
|
||||
|
||||
println!("{}: Building transaction", now() - start_time);
|
||||
let (tx, _) = match builder.build(
|
||||
consensus_branch_id,
|
||||
prover::InMemTxProver::new(spend_params, output_params),
|
||||
BranchId::try_from(consensus_branch_id).unwrap(),
|
||||
&prover::InMemTxProver::new(spend_params, output_params),
|
||||
) {
|
||||
Ok(res) => res,
|
||||
Err(e) => {
|
||||
@@ -1669,7 +1671,7 @@ impl LightWallet {
|
||||
Some(s) => {
|
||||
// If the address is not a z-address, then drop the memo
|
||||
if LightWallet::is_shielded_address(&addr.to_string(), &self.config) {
|
||||
Memo::from_str(s).unwrap()
|
||||
Memo::from_bytes(s.as_bytes()).unwrap()
|
||||
} else {
|
||||
Memo::default()
|
||||
}
|
||||
|
Reference in New Issue
Block a user