aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-25 00:17:32 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-25 00:17:32 +0200
commit9b4117b40171262d01944acd1e43e830914d421d (patch)
tree28a2c83652dc7c62fa39f6c76f878ad74773fed9 /src
parentMerge pull request #2326 (diff)
parentdaemon: print estimated tx backlog in print_pool_stats (diff)
downloadmonero-9b4117b40171262d01944acd1e43e830914d421d.tar.xz
Merge pull request #2328
679a5ab8 daemon: print estimated tx backlog in print_pool_stats (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/daemon/rpc_command_executor.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index bd2142ab1..0dca06828 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -939,6 +939,8 @@ bool t_rpc_command_executor::print_transaction_pool_short() {
bool t_rpc_command_executor::print_transaction_pool_stats() {
cryptonote::COMMAND_RPC_GET_TRANSACTION_POOL_STATS::request req;
cryptonote::COMMAND_RPC_GET_TRANSACTION_POOL_STATS::response res;
+ cryptonote::COMMAND_RPC_GET_INFO::request ireq;
+ cryptonote::COMMAND_RPC_GET_INFO::response ires;
std::string fail_message = "Problem fetching transaction pool stats";
@@ -948,6 +950,10 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
{
return true;
}
+ if (!m_rpc_client->rpc_request(ireq, ires, "/getinfo", fail_message.c_str()))
+ {
+ return true;
+ }
}
else
{
@@ -957,15 +963,31 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
tools::fail_msg_writer() << make_error(fail_message, res.status);
return true;
}
+ if (!m_rpc_server->on_get_info(ireq, ires) || ires.status != CORE_RPC_STATUS_OK)
+ {
+ tools::fail_msg_writer() << make_error(fail_message, ires.status);
+ return true;
+ }
}
size_t n_transactions = res.pool_stats.txs_total;
const uint64_t now = time(NULL);
size_t avg_bytes = n_transactions ? res.pool_stats.bytes_total / n_transactions : 0;
+ std::string backlog_message;
+ if (res.pool_stats.bytes_total <= ires.block_size_limit)
+ {
+ backlog_message = "no backlog";
+ }
+ else
+ {
+ uint64_t backlog = (res.pool_stats.bytes_total + ires.block_size_limit - 1) / ires.block_size_limit;
+ backlog_message = (boost::format("estimated %u block (%u minutes) backlog") % backlog % (backlog * DIFFICULTY_TARGET_V2 / 60)).str();
+ }
+
tools::msg_writer() << n_transactions << " tx(es), " << res.pool_stats.bytes_total << " bytes total (min " << res.pool_stats.bytes_min << ", max " << res.pool_stats.bytes_max << ", avg " << avg_bytes << ")" << std::endl
- << "fees " << cryptonote::print_money(res.pool_stats.fee_total) << " (avg " << cryptonote::print_money(n_transactions ? res.pool_stats.fee_total / n_transactions : 0) << " per tx" << ", " << cryptonote::print_money(res.pool_stats.bytes_total ? res.pool_stats.fee_total / res.pool_stats.bytes_total : 0) << " per byte )" << std::endl
- << res.pool_stats.num_not_relayed << " not relayed, " << res.pool_stats.num_failing << " failing, " << res.pool_stats.num_10m << " older than 10 minutes (oldest " << (res.pool_stats.oldest == 0 ? "-" : get_human_time_ago(res.pool_stats.oldest, now)) << ")";
+ << "fees " << cryptonote::print_money(res.pool_stats.fee_total) << " (avg " << cryptonote::print_money(n_transactions ? res.pool_stats.fee_total / n_transactions : 0) << " per tx" << ", " << cryptonote::print_money(res.pool_stats.bytes_total ? res.pool_stats.fee_total / res.pool_stats.bytes_total : 0) << " per byte)" << std::endl
+ << res.pool_stats.num_not_relayed << " not relayed, " << res.pool_stats.num_failing << " failing, " << res.pool_stats.num_10m << " older than 10 minutes (oldest " << (res.pool_stats.oldest == 0 ? "-" : get_human_time_ago(res.pool_stats.oldest, now)) << "), " << backlog_message;
if (n_transactions > 1 && res.pool_stats.histo.size())
{