From 1fcaccf61b7bc649d89c3cd2fda60a8b94c6debb Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 11 Jun 2020 22:20:00 +0300 Subject: [PATCH] fix for #152 --- src/wallet/wallet2.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 93070875..cd7e22f4 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -556,7 +556,11 @@ void wallet2::prepare_wti_decrypted_attachments(wallet_public::wallet_transfer_i if (wti.remote_addresses.empty()) { handle_2_alternative_types_in_variant_container(decrypted_att, [&](const tx_receiver& p) { - std::string addr_str = currency::get_account_address_as_str(p.acc_addr); + std::string addr_str; + if (wti.payment_id.empty()) + addr_str = currency::get_account_address_as_str(p.acc_addr); + else + addr_str = currency::get_account_address_and_payment_id_as_str(p.acc_addr, wti.payment_id); // show integrated address if there's a payment id provided wti.remote_addresses.push_back(addr_str); LOG_PRINT_YELLOW("prepare_wti_decrypted_attachments, income=false, wti.amount = " << print_money_brief(wti.amount) << ", rem. addr = " << addr_str, LOG_LEVEL_0); return true; // continue iterating through the container @@ -3886,6 +3890,9 @@ void wallet2::add_sent_tx_detailed_info(const transaction& tx, const std::vector& destinations, const std::vector& selected_transfers) { + payment_id_t payment_id; + get_payment_id_from_tx(tx.attachment, payment_id); + std::vector recipients; std::unordered_set used_addresses; for (const auto& d : destinations) @@ -3893,13 +3900,13 @@ void wallet2::add_sent_tx_detailed_info(const transaction& tx, for (const auto& addr : d.addr) { if (used_addresses.insert(addr).second && addr != m_account.get_public_address()) - recipients.push_back(get_account_address_as_str(addr)); + recipients.push_back(payment_id.empty() ? get_account_address_as_str(addr) : get_account_address_and_payment_id_as_str(addr, payment_id)); } } if (!recipients.size()) { //transaction send to ourself - recipients.push_back(get_account_address_as_str(m_account.get_public_address())); + recipients.push_back(payment_id.empty() ? get_account_address_as_str(m_account.get_public_address()) : get_account_address_and_payment_id_as_str(m_account.get_public_address(), payment_id)); } add_sent_unconfirmed_tx(tx, recipients, selected_transfers, destinations);