From 6b40ea937abfa6de8f76f80366745650b831268a Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 1 Mar 2018 09:35:12 +0000 Subject: [PATCH] simplewallet: fix print_ring_members printing wrong heights And also use uint64_t instead of int for heights where appropriate --- src/simplewallet/simplewallet.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index c67a6bc6c..888a4eb4a 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3583,14 +3583,25 @@ bool simple_wallet::print_ring_members(const std::vector spent_key_height(tx.vin.size()); + std::vector spent_key_height(tx.vin.size()); std::vector spent_key_txid (tx.vin.size()); for (size_t i = 0; i < tx.vin.size(); ++i) { if (tx.vin[i].type() != typeid(cryptonote::txin_to_key)) continue; const cryptonote::txin_to_key& in_key = boost::get(tx.vin[i]); - const cryptonote::tx_source_entry& source = construction_data.sources[i]; + const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(construction_data.selected_transfers[i]); + const cryptonote::tx_source_entry *sptr = NULL; + for (const auto &src: construction_data.sources) + if (src.outputs[src.real_output].second.dest == td.get_public_key()) + sptr = &src; + if (!sptr) + { + fail_msg_writer() << tr("failed to find construction data for tx input"); + return false; + } + const cryptonote::tx_source_entry& source = *sptr; + ostr << boost::format(tr("\nInput %llu/%llu: amount=%s")) % (i + 1) % tx.vin.size() % print_money(source.amount); // convert relative offsets of ring member keys into absolute offsets (indices) associated with the amount std::vector absolute_offsets = cryptonote::relative_output_offsets_to_absolute(in_key.key_offsets); @@ -3644,7 +3655,7 @@ bool simple_wallet::print_ring_members(const std::vector