From a03b13b50b11638e3c2a6b92a336753572802789 Mon Sep 17 00:00:00 2001 From: NoodleDoodleNoodleDoodleNoodleDoodleNoo Date: Tue, 13 May 2014 17:55:50 -0700 Subject: Update daemon_commands_handler.h 1. Added "diff" command to show current estimated difficulty and hash-rate. --- src/daemon/daemon_commands_handler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/daemon') diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h index dca524f77..74b671e2a 100644 --- a/src/daemon/daemon_commands_handler.h +++ b/src/daemon/daemon_commands_handler.h @@ -34,6 +34,7 @@ public: m_cmd_binder.set_handler("show_hr", boost::bind(&daemon_cmmands_handler::show_hr, this, _1), "Start showing hash rate"); m_cmd_binder.set_handler("hide_hr", boost::bind(&daemon_cmmands_handler::hide_hr, this, _1), "Stop showing hash rate"); m_cmd_binder.set_handler("save", boost::bind(&daemon_cmmands_handler::save, this, _1), "Save blockchain"); + m_cmd_binder.set_handler("diff", boost::bind(&daemon_cmmands_handler::diff, this, _1), "Show difficulty"); } bool start_handling() @@ -98,6 +99,17 @@ private: return true; } //-------------------------------------------------------------------------------- + bool diff(const std::vector& args) + { + cryptonote::difficulty_type difficulty = m_srv.get_payload_object().get_core().get_blockchain_storage().get_difficulty_for_next_block(); + uint64_t height = m_srv.get_payload_object().get_core().get_blockchain_storage().get_current_blockchain_height(); + + LOG_PRINT_GREEN("BH: " << height << ", DIFF: " << difficulty + << ", HR: " << (int) difficulty / 60L << " H/s", LOG_LEVEL_0); + + return true; + } + //-------------------------------------------------------------------------------- bool print_bc_outs(const std::vector& args) { if(args.size() != 1) -- cgit v1.2.3 From 3a3a8176782a4fa75b0607fba0393c9d4a1746be Mon Sep 17 00:00:00 2001 From: mydesktop Date: Sun, 25 May 2014 13:06:40 -0400 Subject: 0.8.8update --- src/daemon/daemon_commands_handler.h | 49 ++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h index 74b671e2a..135ec68f8 100644 --- a/src/daemon/daemon_commands_handler.h +++ b/src/daemon/daemon_commands_handler.h @@ -11,6 +11,7 @@ #include "cryptonote_protocol/cryptonote_protocol_handler.h" #include "common/util.h" #include "crypto/hash.h" +#include "version.h" class daemon_cmmands_handler @@ -34,6 +35,7 @@ public: m_cmd_binder.set_handler("show_hr", boost::bind(&daemon_cmmands_handler::show_hr, this, _1), "Start showing hash rate"); m_cmd_binder.set_handler("hide_hr", boost::bind(&daemon_cmmands_handler::hide_hr, this, _1), "Stop showing hash rate"); m_cmd_binder.set_handler("save", boost::bind(&daemon_cmmands_handler::save, this, _1), "Save blockchain"); + m_cmd_binder.set_handler("set_log", boost::bind(&daemon_cmmands_handler::set_log, this, _1), "set_log - Change current log detalization level, is a number 0-4"); m_cmd_binder.set_handler("diff", boost::bind(&daemon_cmmands_handler::diff, this, _1), "Show difficulty"); } @@ -55,6 +57,7 @@ private: std::string get_commands_str() { std::stringstream ss; + ss << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL; ss << "Commands: " << ENDL; std::string usage = m_cmd_binder.get_usage(); boost::replace_all(usage, "\n", "\n "); @@ -135,19 +138,34 @@ private: return false; } uint64_t start_index = 0; + uint64_t end_index = 0; uint64_t end_block_parametr = m_srv.get_payload_object().get_core().get_current_blockchain_height(); if(!string_tools::get_xtype_from_string(start_index, args[0])) { std::cout << "wrong starter block index parameter" << ENDL; return false; } - if(args.size() >1 && !string_tools::get_xtype_from_string(end_block_parametr, args[1])) + if(args.size() >1 && !string_tools::get_xtype_from_string(end_index, args[1])) { std::cout << "wrong end block index parameter" << ENDL; return false; } + if (end_index == 0) + { + end_index = end_block_parametr; + } + if (end_index > end_block_parametr) + { + std::cout << "end block index parameter shouldn't be greater than " << end_block_parametr << ENDL; + return false; + } + if (end_index <= start_index) + { + std::cout << "end block index should be greater than starter block index" << ENDL; + return false; + } - m_srv.get_payload_object().get_core().print_blockchain(start_index, end_block_parametr); + m_srv.get_payload_object().get_core().print_blockchain(start_index, end_index); return true; } //-------------------------------------------------------------------------------- @@ -156,6 +174,33 @@ private: m_srv.get_payload_object().get_core().print_blockchain_index(); return true; } + + bool set_log(const std::vector& args) + { + if(args.size() != 1) + { + std::cout << "use: set_log " << ENDL; + return true; + } + + uint16_t l = 0; + if(!string_tools::get_xtype_from_string(l, args[0])) + { + std::cout << "wrong number format, use: set_log " << ENDL; + return true; + } + + if(LOG_LEVEL_4 < l) + { + std::cout << "wrong number range, use: set_log " << ENDL; + return true; + } + + log_space::log_singletone::get_set_log_detalisation_level(true, l); + + return true; + } + //-------------------------------------------------------------------------------- template static bool print_as_json(T& obj) -- cgit v1.2.3