diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-07 16:35:49 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-07 16:45:54 +0100 |
commit | b776c7256852c85d5d518a663e6ff8acbab17024 (patch) | |
tree | c4b65d9a1f52c3e12caf0994ca286e10b95878c0 /src/daemon/command_parser_executor.cpp | |
parent | Merge pull request #2548 (diff) | |
download | monero-b776c7256852c85d5d518a663e6ff8acbab17024.tar.xz |
daemon: use @N syntax to output_histogram for specific amounts
Makes debugging tx verification easier
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r-- | src/daemon/command_parser_executor.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index af46453cd..27363e7c6 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -493,20 +493,34 @@ bool t_command_parser_executor::flush_txpool(const std::vector<std::string>& arg bool t_command_parser_executor::output_histogram(const std::vector<std::string>& args) { - if (args.size() > 2) return false; - + std::vector<uint64_t> amounts; uint64_t min_count = 3; uint64_t max_count = 0; + size_t n_raw = 0; - if (args.size() >= 1) - { - min_count = boost::lexical_cast<uint64_t>(args[0]); - } - if (args.size() >= 2) + for (size_t n = 0; n < args.size(); ++n) { - max_count = boost::lexical_cast<uint64_t>(args[1]); + if (args[n][0] == '@') + { + amounts.push_back(boost::lexical_cast<uint64_t>(args[n].c_str() + 1)); + } + else if (n_raw == 0) + { + min_count = boost::lexical_cast<uint64_t>(args[n]); + n_raw++; + } + else if (n_raw == 1) + { + max_count = boost::lexical_cast<uint64_t>(args[n]); + n_raw++; + } + else + { + std::cout << "Invalid syntax: more than two non-amount parameters" << std::endl; + return true; + } } - return m_executor.output_histogram(min_count, max_count); + return m_executor.output_histogram(amounts, min_count, max_count); } bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::string>& args) |