aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-11-19 16:30:19 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-01-26 00:03:53 +0000
commitdd8c6b170386b64ae1d4344c7abd93d7b814a43b (patch)
treedbba8d82ef4bfc7a14fcbf9de9066c8914ebbd12 /src/simplewallet
parentMerge pull request #6093 (diff)
downloadmonero-dd8c6b170386b64ae1d4344c7abd93d7b814a43b.tar.xz
wallet: do not split integrated addresses in address book api
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 87bbf62d3..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>");
@@ -9385,29 +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();
- }
- 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)
{
@@ -9415,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
{
@@ -9437,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";
}
}