From 2a5383d83ecc7e417f154b70d3e1518175f8cef2 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 16 Jun 2020 15:11:13 +0100 Subject: [PATCH] Default to outputting payment proof unless requested otherwise (#447) --- src/bin/grin-wallet.yml | 10 +++++----- src/cmd/wallet_args.rs | 25 ++++++------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/bin/grin-wallet.yml b/src/bin/grin-wallet.yml index c9058977..484981f6 100644 --- a/src/bin/grin-wallet.yml +++ b/src/bin/grin-wallet.yml @@ -123,10 +123,10 @@ subcommands: short: d long: dest takes_value: true - - request_payment_proof: - help: Request a payment proof from the recipient. If present, the destination must be provided as a slatepack address. - short: y - long: request_payment_proof + - no_payment_proof: + help: Don't request a payment proof, even if the Recipient's Slatepack address is provided in the -dest argument + short: n + long: no_payment_proof - fluff: help: Fluff the transaction (ignore Dandelion relay protocol) short: f @@ -322,7 +322,7 @@ subcommands: - recover: about: Displays a recovery phrase for the wallet. (use `init -r` to perform recovery) - address: - about: Display the wallet's payment proof address + about: Display the wallet's Slatepack address - scan: about: Checks a wallet's outputs against a live node, repairing and restoring missing outputs if required args: diff --git a/src/cmd/wallet_args.rs b/src/cmd/wallet_args.rs index 7c182429..e87b650c 100644 --- a/src/cmd/wallet_args.rs +++ b/src/cmd/wallet_args.rs @@ -31,7 +31,6 @@ use grin_wallet_libwallet::{IssueInvoiceTxArgs, NodeClient, WalletInst, WalletLC use grin_wallet_util::grin_core as core; use grin_wallet_util::grin_core::core::amount_to_hr_string; use grin_wallet_util::grin_keychain as keychain; -use grin_wallet_util::OnionV3Address; use linefeed::terminal::Signal; use linefeed::{Interface, ReadResult}; use rpassword; @@ -503,27 +502,15 @@ pub fn parse_send_args(args: &ArgMatches) -> Result match OnionV3Address::try_from(dest) { - Ok(a) => Some(SlatepackAddress::try_from(a).unwrap()), + match args.is_present("no_payment_proof") { + false => match SlatepackAddress::try_from(dest) { + Ok(a) => Some(a), Err(_) => { - let addr = match parse_required(args, "dest") { - Ok(a) => a, - Err(_) => { - let msg = format!("Destination Slatepack address must be provided (-d) if payment proof is requested"); - return Err(ParseError::ArgumentError(msg)); - } - }; - match SlatepackAddress::try_from(addr) { - Ok(a) => Some(a), - Err(e) => { - let msg = format!("Invalid slatepack address: {:?}", e); - return Err(ParseError::ArgumentError(msg)); - } - } + println!("No recipient Slatepack address. No payment proof will be requested."); + None } }, - false => None, + true => None, } };