aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp62
1 files changed, 9 insertions, 53 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index ea8f6f2f5..d38673cdf 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -196,7 +196,7 @@ namespace
" account tag_description <tag_name> <description>");
const char* USAGE_ADDRESS("address [ new <label text with white spaces allowed> | all | <index_min> [<index_max>] | label <index> <label text with white spaces allowed> | device [<index>]]");
const char* USAGE_INTEGRATED_ADDRESS("integrated_address [device] [<payment_id> | <address>]");
- const char* USAGE_ADDRESS_BOOK("address_book [(add ((<address> [pid <id>])|<integrated address>) [<description possibly with whitespaces>])|(delete <index>)]");
+ const char* USAGE_ADDRESS_BOOK("address_book [(add (<address>|<integrated address>) [<description possibly with whitespaces>])|(delete <index>)]");
const char* USAGE_SET_VARIABLE("set <option> [<value>]");
const char* USAGE_GET_TX_KEY("get_tx_key <txid>");
const char* USAGE_SET_TX_KEY("set_tx_key <txid> <tx_key>");
@@ -912,16 +912,6 @@ bool simple_wallet::change_password(const std::vector<std::string> &args)
bool simple_wallet::payment_id(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
LONG_PAYMENT_ID_SUPPORT_CHECK();
-
- crypto::hash payment_id;
- if (args.size() > 0)
- {
- PRINT_USAGE(USAGE_PAYMENT_ID);
- return true;
- }
- payment_id = crypto::rand<crypto::hash>();
- success_msg_writer() << tr("Random payment ID: ") << payment_id;
- return true;
}
bool simple_wallet::print_fee_info(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
@@ -4356,7 +4346,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (std::cin.eof() || !command_line::is_yes(confirm))
CHECK_AND_ASSERT_MES(false, false, tr("account creation aborted"));
- m_wallet->set_refresh_from_block_height(m_wallet->estimate_blockchain_height());
+ m_wallet->set_refresh_from_block_height(m_wallet->estimate_blockchain_height() > 0 ? m_wallet->estimate_blockchain_height() - 1 : 0);
m_wallet->explicit_refresh_from_block_height(true);
m_restore_height = m_wallet->get_refresh_from_block_height();
}
@@ -6293,13 +6283,6 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
if (tools::wallet2::parse_long_payment_id(payment_id_str, payment_id))
{
LONG_PAYMENT_ID_SUPPORT_CHECK();
-
- std::string extra_nonce;
- set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id);
- r = add_extra_nonce_to_tx_extra(extra, extra_nonce);
- local_args.pop_back();
- payment_id_seen = true;
- message_writer() << tr("Warning: Unencrypted payment IDs will harm your privacy: ask the recipient to use subaddresses instead");
}
if(!r)
{
@@ -6408,8 +6391,6 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri
else if (tools::wallet2::parse_payment_id(payment_id_uri, payment_id))
{
LONG_PAYMENT_ID_SUPPORT_CHECK();
- set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id);
- message_writer() << tr("Warning: Unencrypted payment IDs will harm your privacy: ask the recipient to use subaddresses instead");
}
else
{
@@ -6945,11 +6926,6 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
if(r)
{
LONG_PAYMENT_ID_SUPPORT_CHECK();
-
- std::string extra_nonce;
- set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id);
- r = add_extra_nonce_to_tx_extra(extra, extra_nonce);
- payment_id_seen = true;
}
if(!r && local_args.size() == 3)
@@ -7191,7 +7167,6 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
if (tools::wallet2::parse_long_payment_id(local_args.back(), payment_id))
{
LONG_PAYMENT_ID_SUPPORT_CHECK();
- set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id);
}
else
{
@@ -9410,30 +9385,7 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
fail_msg_writer() << tr("failed to parse address");
return true;
}
- crypto::hash payment_id = crypto::null_hash;
size_t description_start = 2;
- if (info.has_payment_id)
- {
- memcpy(payment_id.data, info.payment_id.data, 8);
- }
- else if (!info.has_payment_id && args.size() >= 4 && args[2] == "pid")
- {
- if (tools::wallet2::parse_long_payment_id(args[3], payment_id))
- {
- LONG_PAYMENT_ID_SUPPORT_CHECK();
- description_start += 2;
- }
- else if (tools::wallet2::parse_short_payment_id(args[3], info.payment_id))
- {
- fail_msg_writer() << tr("Short payment IDs are to be used within an integrated address only");
- return true;
- }
- else
- {
- fail_msg_writer() << tr("failed to parse payment ID");
- return true;
- }
- }
std::string description;
for (size_t i = description_start; i < args.size(); ++i)
{
@@ -9441,7 +9393,7 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
description += " ";
description += args[i];
}
- m_wallet->add_address_book_row(info.address, payment_id, description, info.is_subaddress);
+ m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, description, info.is_subaddress);
}
else
{
@@ -9463,8 +9415,12 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
for (size_t i = 0; i < address_book.size(); ++i) {
auto& row = address_book[i];
success_msg_writer() << tr("Index: ") << i;
- success_msg_writer() << tr("Address: ") << get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address);
- success_msg_writer() << tr("Payment ID: ") << row.m_payment_id << " (OBSOLETE)";
+ std::string address;
+ if (row.m_has_payment_id)
+ address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id);
+ else
+ address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address);
+ success_msg_writer() << tr("Address: ") << address;
success_msg_writer() << tr("Description: ") << row.m_description << "\n";
}
}