From b2cb640b112e871b56944938273f49732644d515 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 23 Dec 2018 15:14:16 +0000 Subject: [PATCH] simplewallet: fix show_transfers colouring, and add red for failed Also add the type back, as it was somehow weirdly split into two different fields, one being a union... --- src/simplewallet/simplewallet.cpp | 6 +++++- src/simplewallet/simplewallet.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 79e7bf822..bb7d7b8cb 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -7229,6 +7229,7 @@ bool simple_wallet::get_transfers(std::vector& local_args, std::vec const std::string type = pd.m_coinbase ? tr("block") : tr("in"); const bool unlocked = m_wallet->is_transfer_unlocked(pd.m_unlock_time, pd.m_block_height); transfers.push_back({ + type, pd.m_block_height, pd.m_timestamp, type, @@ -7261,6 +7262,7 @@ bool simple_wallet::get_transfers(std::vector& local_args, std::vec payment_id = payment_id.substr(0,16); std::string note = m_wallet->get_tx_note(i->first); transfers.push_back({ + "out", pd.m_block_height, pd.m_timestamp, "out", @@ -7297,6 +7299,7 @@ bool simple_wallet::get_transfers(std::vector& local_args, std::vec if (i->second.m_double_spend_seen) double_spend_note = tr("[Double spend seen on the network: this transaction may or may not end up being mined] "); transfers.push_back({ + "pool", "pool", pd.m_timestamp, "in", @@ -7337,6 +7340,7 @@ bool simple_wallet::get_transfers(std::vector& local_args, std::vec bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed; if ((failed && is_failed) || (!is_failed && pending)) { transfers.push_back({ + (is_failed ? "failed" : "pending"), (is_failed ? "failed" : "pending"), pd.m_timestamp, "out", @@ -7385,7 +7389,7 @@ bool simple_wallet::show_transfers(const std::vector &args_) for (const auto& transfer : all_transfers) { - const auto color = transfer.confirmed ? ((transfer.direction == "in" || transfer.direction == "block") ? console_color_green : console_color_magenta) : console_color_white; + const auto color = transfer.type == "failed" ? console_color_red : transfer.confirmed ? ((transfer.direction == "in" || transfer.direction == "block") ? console_color_green : console_color_magenta) : console_color_default; std::string destinations = "-"; if (!transfer.outputs.empty()) diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 2bdda882b..681bcf215 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -254,6 +254,7 @@ namespace cryptonote struct transfer_view { + std::string type; boost::variant block; uint64_t timestamp; std::string direction;