simplewallet: don't confirm missing payment ID when sending to only subaddresses

This commit is contained in:
stoffu 2018-06-10 20:00:59 +09:00 committed by wowario
parent 328b5ebc69
commit 826da63a0b
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111
1 changed files with 5 additions and 3 deletions

View File

@ -4362,6 +4362,7 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
} }
vector<cryptonote::tx_destination_entry> dsts; vector<cryptonote::tx_destination_entry> dsts;
size_t num_subaddresses = 0;
for (size_t i = 0; i < local_args.size(); i += 2) for (size_t i = 0; i < local_args.size(); i += 2)
{ {
cryptonote::address_parse_info info; cryptonote::address_parse_info info;
@ -4373,6 +4374,7 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
} }
de.addr = info.address; de.addr = info.address;
de.is_subaddress = info.is_subaddress; de.is_subaddress = info.is_subaddress;
num_subaddresses += info.is_subaddress;
if (info.has_payment_id) if (info.has_payment_id)
{ {
@ -4405,7 +4407,7 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
} }
// prompt is there is no payment id and confirmation is required // prompt is there is no payment id and confirmation is required
if (!payment_id_seen && m_wallet->confirm_missing_payment_id()) if (!payment_id_seen && m_wallet->confirm_missing_payment_id() && dsts.size() > num_subaddresses)
{ {
std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): ")); std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): "));
if (std::cin.eof()) if (std::cin.eof())
@ -4823,7 +4825,7 @@ bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &a
} }
// prompt is there is no payment id and confirmation is required // prompt is there is no payment id and confirmation is required
if (!payment_id_seen && m_wallet->confirm_missing_payment_id()) if (!payment_id_seen && m_wallet->confirm_missing_payment_id() && !info.is_subaddress)
{ {
std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): ")); std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): "));
if (std::cin.eof()) if (std::cin.eof())
@ -5022,7 +5024,7 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
} }
// prompt if there is no payment id and confirmation is required // prompt if there is no payment id and confirmation is required
if (!payment_id_seen && m_wallet->confirm_missing_payment_id()) if (!payment_id_seen && m_wallet->confirm_missing_payment_id() && !info.is_subaddress)
{ {
std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): ")); std::string accepted = input_line(tr("No payment id is included with this transaction. Is this okay? (Y/Yes/N/No): "));
if (std::cin.eof()) if (std::cin.eof())