aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/rpc_command_executor.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-10-11 10:30:52 +0200
committerRiccardo Spagni <ric@spagni.net>2016-10-11 10:30:53 +0200
commit3db0ebafe54044fea13d8d5f09948210855fbae6 (patch)
treebb4a186e6ef10ec4aa836887d4187f4f4f510572 /src/daemon/rpc_command_executor.cpp
parentMerge pull request #1205 (diff)
parentprint_coinbase_tx_sum now breaks output into fee and emission components (diff)
downloadmonero-3db0ebafe54044fea13d8d5f09948210855fbae6.tar.xz
Merge pull request #1204
7db29d6 print_coinbase_tx_sum now breaks output into fee and emission components (Dion Ahmetaj) dd6c443 changed params from start/end index to height/count (Dion Ahmetaj) e95d3f3 attempted to remove whitespace spam (Dion Ahmetaj) 412da63 added print_coinbase_tx_sum option (Dion Ahmetaj)
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
-rw-r--r--src/daemon/rpc_command_executor.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index e7229f7f9..db0d0a6e4 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1270,5 +1270,40 @@ 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 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.height = height;
+ req.count = count;
+
+ std::string fail_message = "Unsuccessful";
+
+ if (m_is_rpc)
+ {
+ if (!m_rpc_client->json_rpc_request(req, res, "get_coinbase_tx_sum", fail_message.c_str()))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if (!m_rpc_server->on_get_coinbase_tx_sum(req, res, error_resp))
+ {
+ tools::fail_msg_writer() << fail_message.c_str();
+ return true;
+ }
+ }
+
+ tools::msg_writer() << "Sum of coinbase transactions between block heights ["
+ << height << ", " << (height + count) << ") is "
+ << cryptonote::print_money(res.emission_amount + res.fee_amount) << " "
+ << "consisting of " << cryptonote::print_money(res.emission_amount)
+ << " in emissions, and " << cryptonote::print_money(res.fee_amount) << " in fees";
+ return true;
+}
+
}// namespace daemonize