diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-10-11 10:30:52 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-10-11 10:30:53 +0200 |
commit | 3db0ebafe54044fea13d8d5f09948210855fbae6 (patch) | |
tree | bb4a186e6ef10ec4aa836887d4187f4f4f510572 /src/rpc | |
parent | Merge pull request #1205 (diff) | |
parent | print_coinbase_tx_sum now breaks output into fee and emission components (diff) | |
download | monero-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/rpc')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 8 | ||||
-rw-r--r-- | src/rpc/core_rpc_server.h | 2 | ||||
-rw-r--r-- | src/rpc/core_rpc_server_commands_defs.h | 28 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 700019250..e8b2d5cb1 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1266,6 +1266,14 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ + 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) + { + std::pair<uint64_t, uint64_t> amounts = m_core.get_coinbase_tx_sum(req.height, req.count); + res.emission_amount = amounts.first; + res.fee_amount = amounts.second; + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_out_peers(const COMMAND_RPC_OUT_PEERS::request& req, COMMAND_RPC_OUT_PEERS::response& res) { // TODO diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h index 68da59f6b..147f019d6 100644 --- a/src/rpc/core_rpc_server.h +++ b/src/rpc/core_rpc_server.h @@ -115,6 +115,7 @@ namespace cryptonote MAP_JON_RPC_WE_IF("flush_txpool", on_flush_txpool, COMMAND_RPC_FLUSH_TRANSACTION_POOL, !m_restricted) MAP_JON_RPC_WE("get_output_histogram", on_get_output_histogram, COMMAND_RPC_GET_OUTPUT_HISTOGRAM) MAP_JON_RPC_WE("get_version", on_get_version, COMMAND_RPC_GET_VERSION) + MAP_JON_RPC_WE("get_coinbase_tx_sum", on_get_coinbase_tx_sum, COMMAND_RPC_GET_COINBASE_TX_SUM) END_JSON_RPC_MAP() END_URI_MAP2() @@ -160,6 +161,7 @@ namespace cryptonote bool on_flush_txpool(const COMMAND_RPC_FLUSH_TRANSACTION_POOL::request& req, COMMAND_RPC_FLUSH_TRANSACTION_POOL::response& res, epee::json_rpc::error& error_resp); bool on_get_output_histogram(const COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request& req, COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response& res, epee::json_rpc::error& error_resp); bool on_get_version(const COMMAND_RPC_GET_VERSION::request& req, COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& error_resp); + bool 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); //----------------------- private: diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index dd2116e51..61c302e45 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -1226,5 +1226,31 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; }; -} + struct COMMAND_RPC_GET_COINBASE_TX_SUM + { + struct request + { + uint64_t height; + uint64_t count; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(height); + KV_SERIALIZE(count); + END_KV_SERIALIZE_MAP() + }; + + struct response + { + std::string status; + uint64_t emission_amount; + uint64_t fee_amount; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(status) + KV_SERIALIZE(emission_amount) + KV_SERIALIZE(fee_amount) + END_KV_SERIALIZE_MAP() + }; + }; +} |