mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 10:01:02 +00:00
changed params from start/end index to height/count
This commit is contained in:
parent
e95d3f359b
commit
dd6c44327b
10 changed files with 27 additions and 27 deletions
|
@ -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<block> 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);
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -456,23 +456,23 @@ bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::str
|
|||
{
|
||||
if(!args.size())
|
||||
{
|
||||
std::cout << "need block index parameter" << std::endl;
|
||||
std::cout << "need block height 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]))
|
||||
uint64_t height = 0;
|
||||
uint64_t count = 0;
|
||||
if(!epee::string_tools::get_xtype_from_string(height, args[0]))
|
||||
{
|
||||
std::cout << "wrong starter block index parameter" << std::endl;
|
||||
std::cout << "wrong starter block height parameter" << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(args.size() >1 && !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
|
||||
|
|
|
@ -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)"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue