Cleanup (send working)

This commit is contained in:
Aditya Kulkarni 2019-09-08 22:14:33 -07:00
parent 3ff71f26b7
commit c4083a835f
3 changed files with 6 additions and 22 deletions

View File

@ -90,7 +90,7 @@ impl Command for SendCommand {
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
lightclient.do_send(
"ztestsapling1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d".to_string(),
1500000,
150000,
Some("Hello from the command".to_string()));
}
}
@ -123,7 +123,7 @@ impl Command for SeedCommand {
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
let phrase = lightclient.do_seed_phrase();
println!("Current seed phrase. PLEASE SAVE THIS CAREFULLY AND DO NOT SHARE IT");
println!("PLEASE SAVE YOUR SEED PHRASE CAREFULLY AND DO NOT SHARE IT");
println!();
println!("{}", phrase);
println!();

View File

@ -39,8 +39,8 @@ pub struct LightClient {
}
impl LightClient {
pub fn new(seed_phrase: Option<&str>) -> io::Result<Self> {
pub fn new(seed_phrase: Option<&str>) -> io::Result<Self> {
let mut lc = if Path::new("wallet.dat").exists() {
// Make sure that if a wallet exists, there is no seed phrase being attempted
if !seed_phrase.is_none() {
@ -58,7 +58,7 @@ impl LightClient {
}
} else {
let l = LightClient {
wallet : Arc::new(LightWallet::new(seed_phrase).unwrap()),
wallet : Arc::new(LightWallet::new(seed_phrase)?),
sapling_output : vec![],
sapling_spend : vec![]
};
@ -287,23 +287,6 @@ impl LightClient {
light_wallet_clone.scan_full_tx(&tx);
});
};
// // Print all the memos for fun.
// let memos = self.wallet.txs.read().unwrap()
// .values().flat_map(|wtx| {
// wtx.notes.iter().map(|nd| nd.memo.clone() ).collect::<Vec<Option<Memo>>>()
// })
// .map( |m| match m {
// Some(memo) => {
// match memo.to_utf8() {
// Some(Ok(memo_str)) => Some(memo_str),
// _ => None
// }
// }
// _ => None
// })
// .collect::<Vec<Option<String>>>();
//println!("All Wallet Txns {:?}", memos);
}
pub fn do_send(&self, addr: String, value: u64, memo: Option<String>) {

View File

@ -879,7 +879,8 @@ impl LightWallet {
println!("{}: Adding output", now() - start_time);
if let Err(e) = match to {
address::RecipientAddress::Shielded(to) => {
builder.add_sapling_output(ovk, to.clone(), value, encoded_memo)
// TODO Make it use encoded_memo
builder.add_sapling_output(ovk, to.clone(), value, None)
}
address::RecipientAddress::Transparent(to) => {
builder.add_transparent_output(&to, value)