mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 12:08:52 +00:00
daemon: use @N syntax to output_histogram for specific amounts
Makes debugging tx verification easier
This commit is contained in:
parent
86e9de588c
commit
b776c72568
@ -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)
|
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 min_count = 3;
|
||||||
uint64_t max_count = 0;
|
uint64_t max_count = 0;
|
||||||
|
size_t n_raw = 0;
|
||||||
|
|
||||||
if (args.size() >= 1)
|
for (size_t n = 0; n < args.size(); ++n)
|
||||||
{
|
{
|
||||||
min_count = boost::lexical_cast<uint64_t>(args[0]);
|
if (args[n][0] == '@')
|
||||||
}
|
|
||||||
if (args.size() >= 2)
|
|
||||||
{
|
{
|
||||||
max_count = boost::lexical_cast<uint64_t>(args[1]);
|
amounts.push_back(boost::lexical_cast<uint64_t>(args[n].c_str() + 1));
|
||||||
}
|
}
|
||||||
return m_executor.output_histogram(min_count, max_count);
|
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(amounts, min_count, max_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::string>& args)
|
bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::string>& args)
|
||||||
|
@ -1490,13 +1490,14 @@ bool t_rpc_command_executor::flush_txpool(const std::string &txid)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool t_rpc_command_executor::output_histogram(uint64_t min_count, uint64_t max_count)
|
bool t_rpc_command_executor::output_histogram(const std::vector<uint64_t> &amounts, uint64_t min_count, uint64_t max_count)
|
||||||
{
|
{
|
||||||
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request req;
|
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request req;
|
||||||
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response res;
|
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response res;
|
||||||
std::string fail_message = "Unsuccessful";
|
std::string fail_message = "Unsuccessful";
|
||||||
epee::json_rpc::error error_resp;
|
epee::json_rpc::error error_resp;
|
||||||
|
|
||||||
|
req.amounts = amounts;
|
||||||
req.min_count = min_count;
|
req.min_count = min_count;
|
||||||
req.max_count = max_count;
|
req.max_count = max_count;
|
||||||
req.unlocked = false;
|
req.unlocked = false;
|
||||||
|
@ -137,7 +137,7 @@ public:
|
|||||||
|
|
||||||
bool flush_txpool(const std::string &txid);
|
bool flush_txpool(const std::string &txid);
|
||||||
|
|
||||||
bool output_histogram(uint64_t min_count, uint64_t max_count);
|
bool output_histogram(const std::vector<uint64_t> &amounts, uint64_t min_count, uint64_t max_count);
|
||||||
|
|
||||||
bool print_coinbase_tx_sum(uint64_t height, uint64_t count);
|
bool print_coinbase_tx_sum(uint64_t height, uint64_t count);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user