diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index f0cd0a740..cbd655460 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -7595,7 +7595,8 @@ bool simple_wallet::accept_loaded_tx(const std::function get_num_txes, std::string change_string; if (change > 0) { - std::string address = get_account_address_as_str(m_wallet->nettype(), get_tx(0).subaddr_account > 0, get_tx(0).change_dts.addr); + const tools::wallet2::tx_construction_data &cd = get_tx(first_known_non_zero_change_index); + std::string address = get_account_address_as_str(m_wallet->nettype(), cd.subaddr_account > 0, cd.change_dts.addr); change_string += (boost::format(tr("%s change to %s")) % print_money(change) % address).str(); } else diff --git a/src/wallet/api/unsigned_transaction.cpp b/src/wallet/api/unsigned_transaction.cpp index 11301595d..931b91406 100644 --- a/src/wallet/api/unsigned_transaction.cpp +++ b/src/wallet/api/unsigned_transaction.cpp @@ -212,7 +212,8 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function get_nu std::string change_string; if (change > 0) { - std::string address = get_account_address_as_str(m_wallet.m_wallet->nettype(), get_tx(0).subaddr_account > 0, get_tx(0).change_dts.addr); + const tools::wallet2::tx_construction_data &cd = get_tx(first_known_non_zero_change_index); + std::string address = get_account_address_as_str(m_wallet.m_wallet->nettype(), cd.subaddr_account > 0, cd.change_dts.addr); change_string += (boost::format(tr("%s change to %s")) % cryptonote::print_money(change) % address).str(); } else diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index e64df5866..f8ce24658 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -1638,8 +1638,7 @@ namespace tools if (desc.change_amount > 0) { - const tools::wallet2::tx_construction_data &cd0 = tx_constructions[0]; - desc.change_address = get_account_address_as_str(m_wallet->nettype(), cd0.subaddr_account > 0, cd0.change_dts.addr); + desc.change_address = get_account_address_as_str(m_wallet->nettype(), cd.subaddr_account > 0, cd.change_dts.addr); res.summary.change_address = desc.change_address; }