diff options
author | Neozaru <neozaru@mailoo.org> | 2014-05-25 21:36:12 +0200 |
---|---|---|
committer | Neozaru <neozaru@mailoo.org> | 2014-05-25 21:36:12 +0200 |
commit | af5a28efe5b914e6154048384d82c4b0dbfdb0dc (patch) | |
tree | 5304e5cd34cc21477837a7b453ac37b489bec679 /src/rpc/core_rpc_server.cpp | |
parent | 'getaddress' wallet-rpc command (diff) | |
download | monero-af5a28efe5b914e6154048384d82c4b0dbfdb0dc.tar.xz |
'mining_status' Daemon RPC command
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 2c4e82085..e4208b0bb 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -275,6 +275,24 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool core_rpc_server::on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res, connection_context& cntx) + { + CHECK_CORE_READY(); + + const miner& lMiner = m_core.get_miner(); + res.active = lMiner.is_mining(); + + if ( lMiner.is_mining() ) { + res.speed = lMiner.get_speed(); + res.threads_count = lMiner.get_threads_count(); + const account_public_address& lMiningAdr = lMiner.get_mining_address(); + res.address = get_account_address_as_str(lMiningAdr); + } + + res.status = CORE_RPC_STATUS_OK; + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_save_bc(const COMMAND_RPC_SAVE_BC::request& req, COMMAND_RPC_SAVE_BC::response& res, connection_context& cntx) { CHECK_CORE_READY(); |