aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-23 12:12:06 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-23 12:12:06 +0100
commit679a5ab85bf8ef0a269238be03cf72afcc16cad2 (patch)
tree547bab547f07a6004e6a2b914691fb24594f68f9 /src
parentMerge pull request #2303 (diff)
downloadmonero-679a5ab85bf8ef0a269238be03cf72afcc16cad2.tar.xz
daemon: print estimated tx backlog in print_pool_stats
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())
{