diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 394b27e26..5522f5cc0 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -11076,7 +11076,7 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v description += " "; description += args[i]; } - m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, description, info.is_subaddress); + m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, description, info.is_subaddress, info.is_carrot); } else { @@ -11100,9 +11100,9 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v success_msg_writer() << tr("Index: ") << i; 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); + address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id, row.m_is_carrot); else - address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address); + address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address, row.m_is_carrot); success_msg_writer() << tr("Address: ") << address; success_msg_writer() << tr("Description: ") << row.m_description << "\n"; } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 5223950da..7317e91b5 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -4021,7 +4021,7 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, } -bool wallet2::add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress) +bool wallet2::add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot) { wallet2::address_book_row a; a.m_address = address; @@ -4029,6 +4029,7 @@ bool wallet2::add_address_book_row(const cryptonote::account_public_address &add a.m_payment_id = payment_id ? *payment_id : crypto::null_hash8; a.m_description = description; a.m_is_subaddress = is_subaddress; + a.m_is_carrot = is_carrot; auto old_size = m_address_book.size(); m_address_book.push_back(a); @@ -4037,7 +4038,7 @@ bool wallet2::add_address_book_row(const cryptonote::account_public_address &add return false; } -bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress) +bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot) { wallet2::address_book_row a; a.m_address = address; @@ -4045,6 +4046,7 @@ bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_publ a.m_payment_id = payment_id ? *payment_id : crypto::null_hash8; a.m_description = description; a.m_is_subaddress = is_subaddress; + a.m_is_carrot = is_carrot; const auto size = m_address_book.size(); if (row_id >= size) diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 17d69b38a..7c9ea22b1 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -859,6 +859,7 @@ private: std::string m_description; bool m_is_subaddress; bool m_has_payment_id; + bool m_is_carrot; BEGIN_SERIALIZE_OBJECT() VERSION_FIELD(0) @@ -867,6 +868,7 @@ private: FIELD(m_description) FIELD(m_is_subaddress) FIELD(m_has_payment_id) + FIELD(m_is_carrot) END_SERIALIZE() }; @@ -1646,8 +1648,8 @@ private: * \brief GUI Address book get/store */ std::vector get_address_book() const { return m_address_book; } - bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress); - bool set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress); + bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot); + bool set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot); bool delete_address_book_row(std::size_t row_id); uint64_t get_num_rct_outputs(); @@ -2290,7 +2292,7 @@ BOOST_CLASS_VERSION(tools::wallet2::payment_details, 5) BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1) BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8) BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 6) -BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 18) +BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 19) BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0) BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 1) BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1) @@ -2668,6 +2670,9 @@ namespace boost a & x.m_has_payment_id; if (x.m_has_payment_id) a & x.m_payment_id; + if (ver < 19) + return; + a & x.m_is_carrot; } template diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 3a558fdfc..77f3f555e 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -3313,9 +3313,9 @@ namespace tools const auto &entry = ab[idx]; std::string address; if (entry.m_has_payment_id) - address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id); + address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id, entry.m_is_carrot); else - address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address); + address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address, entry.m_is_carrot); res.entries.push_back(wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::entry{idx, address, entry.m_description}); } } @@ -3355,7 +3355,7 @@ namespace tools er.message = std::string("WALLET_RPC_ERROR_CODE_WRONG_ADDRESS: ") + req.address; return false; } - if (!m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, req.description, info.is_subaddress)) + if (!m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, req.description, info.is_subaddress, info.is_carrot)) { er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR; er.message = "Failed to add address book entry"; @@ -3414,12 +3414,13 @@ namespace tools entry.m_is_subaddress = info.is_subaddress; if (info.has_payment_id) entry.m_payment_id = info.payment_id; + entry.m_is_carrot = info.is_carrot; } if (req.set_description) entry.m_description = req.description; - if (!m_wallet->set_address_book_row(req.index, entry.m_address, req.set_address && entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress)) + if (!m_wallet->set_address_book_row(req.index, entry.m_address, req.set_address && entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress, entry.m_is_carrot)) { er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR; er.message = "Failed to edit address book entry";