diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index b8bceb51c..ecbc1067c 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -616,12 +616,12 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- - uint64_t core::get_coinbase_tx_sum(const uint64_t start_height, const uint64_t end_height) + uint64_t core::get_coinbase_tx_sum(const uint64_t start_offset, const uint64_t count) { std::list blocks; uint64_t coinbase_tx_sum = 0; - uint64_t current_index = start_height; - this->get_blocks(start_height, end_height - start_height, blocks); + uint64_t current_index = start_offset; + this->get_blocks(start_offset, count, blocks); BOOST_FOREACH(auto& b, blocks) { coinbase_tx_sum += get_outs_money_amount(b.miner_tx); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 662e7f108..c152e6a3f 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -605,7 +605,7 @@ namespace cryptonote * * @return the number of blocks to sync in one go */ - uint64_t get_coinbase_tx_sum(const uint64_t start_height, const uint64_t end_height); + uint64_t get_coinbase_tx_sum(const uint64_t start_offset, const uint64_t count); private: 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 diff --git a/src/daemon/command_parser_executor.h b/src/daemon/command_parser_executor.h index 316c9e8a9..6a984aa71 100644 --- a/src/daemon/command_parser_executor.h +++ b/src/daemon/command_parser_executor.h @@ -103,7 +103,7 @@ public: bool start_save_graph(const std::vector& args); bool stop_save_graph(const std::vector& args); - + bool hard_fork_info(const std::vector& args); bool show_bans(const std::vector& args); diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp index 2f3643779..1418b920f 100644 --- a/src/daemon/command_server.cpp +++ b/src/daemon/command_server.cpp @@ -218,7 +218,7 @@ t_command_server::t_command_server( m_command_lookup.set_handler( "print_coinbase_tx_sum" , std::bind(&t_command_parser_executor::print_coinbase_tx_sum, &m_parser, p::_1) - , "Print sum of coinbase transactions (start index, end index)" + , "Print sum of coinbase transactions (start height, block count)" ); } diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 80d330e92..bf154597c 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -1270,14 +1270,14 @@ bool t_rpc_command_executor::output_histogram(uint64_t min_count, uint64_t max_c return true; } -bool t_rpc_command_executor::print_coinbase_tx_sum(uint64_t start_block_index, uint64_t end_block_index) +bool t_rpc_command_executor::print_coinbase_tx_sum(uint64_t height, uint64_t count) { cryptonote::COMMAND_RPC_GET_COINBASE_TX_SUM::request req; cryptonote::COMMAND_RPC_GET_COINBASE_TX_SUM::response res; epee::json_rpc::error error_resp; - req.start_height = start_block_index; - req.end_height = end_block_index; + req.height = height; + req.count = count; std::string fail_message = "Unsuccessful"; @@ -1297,8 +1297,8 @@ bool t_rpc_command_executor::print_coinbase_tx_sum(uint64_t start_block_index, u } } - tools::msg_writer() << "Sum of coinbase transactions between block indexes " - << start_block_index << " and " << end_block_index << " (inclusive) is " + tools::msg_writer() << "Sum of coinbase transactions between block heights [" + << height << ", " << (height + count) << ") is " << cryptonote::print_money(res.amount); return true; } diff --git a/src/daemon/rpc_command_executor.h b/src/daemon/rpc_command_executor.h index aa2b89ac2..c097453e7 100644 --- a/src/daemon/rpc_command_executor.h +++ b/src/daemon/rpc_command_executor.h @@ -134,7 +134,7 @@ public: bool output_histogram(uint64_t min_count, uint64_t max_count); - bool print_coinbase_tx_sum(uint64_t start_block_index, uint64_t end_block_index); + bool print_coinbase_tx_sum(uint64_t height, uint64_t count); }; } // namespace daemonize diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index a1744c89c..af36961f2 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1268,7 +1268,7 @@ namespace cryptonote //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_get_coinbase_tx_sum(const COMMAND_RPC_GET_COINBASE_TX_SUM::request& req, COMMAND_RPC_GET_COINBASE_TX_SUM::response& res, epee::json_rpc::error& error_resp) { - res.amount = m_core.get_coinbase_tx_sum(req.start_height, req.end_height); + res.amount = m_core.get_coinbase_tx_sum(req.height, req.count); return true; } //------------------------------------------------------------------------------------------------------------------------------ diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h index 8ccdc0dd3..147f019d6 100644 --- a/src/rpc/core_rpc_server.h +++ b/src/rpc/core_rpc_server.h @@ -128,8 +128,8 @@ namespace cryptonote bool on_send_raw_tx(const COMMAND_RPC_SEND_RAW_TX::request& req, COMMAND_RPC_SEND_RAW_TX::response& res); bool on_start_mining(const COMMAND_RPC_START_MINING::request& req, COMMAND_RPC_START_MINING::response& res); bool on_stop_mining(const COMMAND_RPC_STOP_MINING::request& req, COMMAND_RPC_STOP_MINING::response& res); - bool on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res); - bool on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res); + bool on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res); + bool on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res); bool on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res); bool on_get_random_rct_outs(const COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::request& req, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::response& res); bool on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res); diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 4f79b3ed8..47ce37f2f 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -1231,12 +1231,12 @@ namespace cryptonote { struct request { - uint64_t start_height; - uint64_t end_height; + uint64_t height; + uint64_t count; BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(start_height); - KV_SERIALIZE(end_height); + KV_SERIALIZE(height); + KV_SERIALIZE(count); END_KV_SERIALIZE_MAP() };