From 412da636225f32ba62bdba7e3ed0281dcea08b05 Mon Sep 17 00:00:00 2001 From: Dion Ahmetaj Date: Mon, 10 Oct 2016 15:45:51 -0400 Subject: added print_coinbase_tx_sum option --- src/daemon/command_parser_executor.cpp | 42 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'src/daemon/command_parser_executor.cpp') diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 6ea862b56..94bab17dd 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -1,21 +1,21 @@ // Copyright (c) 2014-2016, The Monero Project -// +// // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. -// +// // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. -// +// // 3. Neither the name of the copyright holder nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL @@ -137,7 +137,7 @@ bool t_command_parser_executor::set_log_level(const std::vector& ar return m_executor.set_log_level(l); } -bool t_command_parser_executor::print_height(const std::vector& args) +bool t_command_parser_executor::print_height(const std::vector& args) { if (!args.empty()) return false; @@ -339,17 +339,17 @@ bool t_command_parser_executor::set_limit_down(const std::vector& a bool t_command_parser_executor::out_peers(const std::vector& args) { if (args.empty()) return false; - + unsigned int limit; try { limit = std::stoi(args[0]); } - + catch(std::invalid_argument& ex) { _erro("stoi exception"); return false; } - + return m_executor.out_peers(limit); } @@ -452,5 +452,27 @@ bool t_command_parser_executor::output_histogram(const std::vector& return m_executor.output_histogram(min_count, max_count); } +bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector& args) +{ + if(!args.size()) + { + std::cout << "need block index parameter" << std::endl; + return false; + } + uint64_t start_index = 0; + uint64_t end_index = 0; + if(!epee::string_tools::get_xtype_from_string(start_index, args[0])) + { + std::cout << "wrong starter block index parameter" << std::endl; + return false; + } + if(args.size() >1 && !epee::string_tools::get_xtype_from_string(end_index, args[1])) + { + std::cout << "wrong end block index parameter" << std::endl; + return false; + } + + return m_executor.print_coinbase_tx_sum(start_index, end_index); +} } // namespace daemonize -- cgit v1.2.3 From e95d3f359b2d87f32abed5dee23c90469144dadf Mon Sep 17 00:00:00 2001 From: Dion Ahmetaj Date: Mon, 10 Oct 2016 16:41:24 -0400 Subject: attempted to remove whitespace spam --- src/daemon/command_parser_executor.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/daemon/command_parser_executor.cpp') diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 94bab17dd..0d810bc32 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -1,21 +1,21 @@ // Copyright (c) 2014-2016, The Monero Project -// +// // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. -// +// // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. -// +// // 3. Neither the name of the copyright holder nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL @@ -137,7 +137,7 @@ bool t_command_parser_executor::set_log_level(const std::vector& ar return m_executor.set_log_level(l); } -bool t_command_parser_executor::print_height(const std::vector& args) +bool t_command_parser_executor::print_height(const std::vector& args) { if (!args.empty()) return false; @@ -339,17 +339,17 @@ bool t_command_parser_executor::set_limit_down(const std::vector& a bool t_command_parser_executor::out_peers(const std::vector& args) { if (args.empty()) return false; - + unsigned int limit; try { limit = std::stoi(args[0]); } - + catch(std::invalid_argument& ex) { _erro("stoi exception"); return false; } - + return m_executor.out_peers(limit); } -- cgit v1.2.3 From dd6c44327be7d90574466bc37561b9d156466972 Mon Sep 17 00:00:00 2001 From: Dion Ahmetaj Date: Mon, 10 Oct 2016 17:19:36 -0400 Subject: changed params from start/end index to height/count --- src/daemon/command_parser_executor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/daemon/command_parser_executor.cpp') diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 0d810bc32..5d7ed6cc0 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -456,23 +456,23 @@ bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector1 && !epee::string_tools::get_xtype_from_string(end_index, args[1])) + if(args.size() >1 && !epee::string_tools::get_xtype_from_string(count, args[1])) { - std::cout << "wrong end block index parameter" << std::endl; + std::cout << "wrong count parameter" << std::endl; return false; } - return m_executor.print_coinbase_tx_sum(start_index, end_index); + return m_executor.print_coinbase_tx_sum(height, count); } } // namespace daemonize -- cgit v1.2.3