diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-11-19 16:30:19 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-01-26 00:03:53 +0000 |
commit | dd8c6b170386b64ae1d4344c7abd93d7b814a43b (patch) | |
tree | dbba8d82ef4bfc7a14fcbf9de9066c8914ebbd12 /src/wallet/wallet2.h | |
parent | Merge pull request #6093 (diff) | |
download | monero-dd8c6b170386b64ae1d4344c7abd93d7b814a43b.tar.xz |
wallet: do not split integrated addresses in address book api
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r-- | src/wallet/wallet2.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 8f840a42d..1faeb1df8 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -546,9 +546,10 @@ private: struct address_book_row { cryptonote::account_public_address m_address; - crypto::hash m_payment_id; + crypto::hash8 m_payment_id; std::string m_description; bool m_is_subaddress; + bool m_has_payment_id; }; struct reserve_proof_entry @@ -1125,8 +1126,8 @@ private: * \brief GUI Address book get/store */ std::vector<address_book_row> get_address_book() const { return m_address_book; } - bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash &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::hash &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 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 delete_address_book_row(std::size_t row_id); uint64_t get_num_rct_outputs(); @@ -1634,7 +1635,7 @@ BOOST_CLASS_VERSION(tools::wallet2::payment_details, 4) 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, 17) +BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 18) BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0) BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 0) BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1) @@ -1954,7 +1955,26 @@ namespace boost inline void serialize(Archive& a, tools::wallet2::address_book_row& x, const boost::serialization::version_type ver) { a & x.m_address; - a & x.m_payment_id; + if (ver < 18) + { + crypto::hash payment_id; + a & payment_id; + x.m_has_payment_id = !(payment_id == crypto::null_hash); + if (x.m_has_payment_id) + { + bool is_long = false; + for (int i = 8; i < 32; ++i) + is_long |= payment_id.data[i]; + if (is_long) + { + MWARNING("Long payment ID ignored on address book load"); + x.m_payment_id = crypto::null_hash8; + x.m_has_payment_id = false; + } + else + memcpy(x.m_payment_id.data, payment_id.data, 8); + } + } a & x.m_description; if (ver < 17) { @@ -1962,6 +1982,11 @@ namespace boost return; } a & x.m_is_subaddress; + if (ver < 18) + return; + a & x.m_has_payment_id; + if (x.m_has_payment_id) + a & x.m_payment_id; } template <class Archive> |