Merge pull request #6213
94266eeb
simplewallet: fix output age display with duplicate heights (moneromooo-monero)f1d379d2
simplewallet: fix "outputs in same tx" detector (moneromooo-monero)
This commit is contained in:
commit
5e492c4cbc
|
@ -5853,8 +5853,14 @@ bool simple_wallet::show_incoming_transfers(const std::vector<std::string>& args
|
|||
if (uses)
|
||||
{
|
||||
std::vector<uint64_t> heights;
|
||||
for (const auto &e: td.m_uses) heights.push_back(e.first);
|
||||
const std::pair<std::string, std::string> line = show_outputs_line(heights, blockchain_height, td.m_spent_height);
|
||||
uint64_t idx = 0;
|
||||
for (const auto &e: td.m_uses)
|
||||
{
|
||||
heights.push_back(e.first);
|
||||
if (e.first < td.m_spent_height)
|
||||
++idx;
|
||||
}
|
||||
const std::pair<std::string, std::string> line = show_outputs_line(heights, blockchain_height, idx);
|
||||
extra_string += std::string("\n ") + tr("Used at heights: ") + line.first + "\n " + line.second;
|
||||
}
|
||||
message_writer(td.m_spent ? console_color_magenta : console_color_green, false) <<
|
||||
|
@ -6023,7 +6029,7 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::pair<std::string, std::string> simple_wallet::show_outputs_line(const std::vector<uint64_t> &heights, uint64_t blockchain_height, uint64_t highlight_height) const
|
||||
std::pair<std::string, std::string> simple_wallet::show_outputs_line(const std::vector<uint64_t> &heights, uint64_t blockchain_height, uint64_t highlight_idx) const
|
||||
{
|
||||
std::stringstream ostr;
|
||||
|
||||
|
@ -6031,7 +6037,7 @@ std::pair<std::string, std::string> simple_wallet::show_outputs_line(const std::
|
|||
blockchain_height = std::max(blockchain_height, h);
|
||||
|
||||
for (size_t j = 0; j < heights.size(); ++j)
|
||||
ostr << (heights[j] == highlight_height ? " *" : " ") << heights[j];
|
||||
ostr << (j == highlight_idx ? " *" : " ") << heights[j];
|
||||
|
||||
// visualize the distribution, using the code by moneroexamples onion-monero-viewer
|
||||
const uint64_t resolution = 79;
|
||||
|
@ -6041,9 +6047,9 @@ std::pair<std::string, std::string> simple_wallet::show_outputs_line(const std::
|
|||
uint64_t pos = (heights[j] * resolution) / blockchain_height;
|
||||
ring_str[pos] = 'o';
|
||||
}
|
||||
if (highlight_height < blockchain_height)
|
||||
if (highlight_idx < heights.size() && heights[highlight_idx] < blockchain_height)
|
||||
{
|
||||
uint64_t pos = (highlight_height * resolution) / blockchain_height;
|
||||
uint64_t pos = (heights[highlight_idx] * resolution) / blockchain_height;
|
||||
ring_str[pos] = '*';
|
||||
}
|
||||
|
||||
|
@ -6103,6 +6109,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
|
|||
req.outputs[j].index = absolute_offsets[j];
|
||||
}
|
||||
COMMAND_RPC_GET_OUTPUTS_BIN::response res = AUTO_VAL_INIT(res);
|
||||
req.get_txid = true;
|
||||
req.client = cryptonote::make_rpc_payment_signature(m_wallet->get_rpc_client_secret_key());
|
||||
bool r = m_wallet->invoke_http_bin("/get_outs.bin", req, res);
|
||||
err = interpret_rpc_response(r, res.status);
|
||||
|
@ -6124,14 +6131,11 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
|
|||
spent_key_height[i] = res.outs[source.real_output].height;
|
||||
spent_key_txid [i] = res.outs[source.real_output].txid;
|
||||
std::vector<uint64_t> heights(absolute_offsets.size(), 0);
|
||||
uint64_t highlight_height = std::numeric_limits<uint64_t>::max();
|
||||
for (size_t j = 0; j < absolute_offsets.size(); ++j)
|
||||
{
|
||||
heights[j] = res.outs[j].height;
|
||||
if (j == source.real_output)
|
||||
highlight_height = heights[j];
|
||||
}
|
||||
std::pair<std::string, std::string> ring_str = show_outputs_line(heights, blockchain_height, highlight_height);
|
||||
std::pair<std::string, std::string> ring_str = show_outputs_line(heights, blockchain_height, source.real_output);
|
||||
ostr << ring_str.first << tr("\n|") << ring_str.second << tr("|\n");
|
||||
}
|
||||
// warn if rings contain keys originating from the same tx or temporally very close block heights
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace cryptonote
|
|||
bool print_seed(bool encrypted);
|
||||
void key_images_sync_intern();
|
||||
void on_refresh_finished(uint64_t start_height, uint64_t fetched_blocks, bool is_init, bool received_money);
|
||||
std::pair<std::string, std::string> show_outputs_line(const std::vector<uint64_t> &heights, uint64_t blockchain_height, uint64_t highlight_height = std::numeric_limits<uint64_t>::max()) const;
|
||||
std::pair<std::string, std::string> show_outputs_line(const std::vector<uint64_t> &heights, uint64_t blockchain_height, uint64_t highlight_idx = std::numeric_limits<uint64_t>::max()) const;
|
||||
bool freeze_thaw(const std::vector<std::string>& args, bool freeze);
|
||||
bool prompt_if_old(const std::vector<tools::wallet2::pending_tx> &ptx_vector);
|
||||
bool on_command(bool (simple_wallet::*cmd)(const std::vector<std::string>&), const std::vector<std::string> &args);
|
||||
|
|
Loading…
Reference in New Issue